Python Loop Over String Javascript Program Code