Javascript Loop Over Array Python