Cses Problem Set Array Method In Javascript