Python Trim String To Integer Javascript Foreach Break Out