Two Pointer Algorithm Javascript Array Methods And Properties