Two Pointer Algorithm Javascript Foreach This Argument Until Bacteria