i need help with a function in javascript.
I have strings like this: 124text or 12hello
I need a function which maked the following:
foo('124text') -> 123
and
foo('12hello') -> 12
in words: i give it a input string and the function return a integer which is the number infront of this string
how to do it with javascript?
parseIntwill do exactly thatLive example: http://jsfiddle.net/eAe4v/