Python Trim String To Integer Javascript Foreach Break