Extract numbers from a String and convert them to integers in JavaScript