Python Loop Over String Javascript Definition