Python Loop Over String Javascript Methods