Javascript How To Loop Over Array Python Methods