Two Pointer Algorithm Javascript Code Compiler