Extract a number from a string (JavaScript)