Two Pointer Algorithm Javascript Alert