How to get specific data from a string?

There is a certain string like 123.45 ABC
How to obtain all digits before the dot mark, it is only 123?
June 5th 19 at 21:33
2 answers
June 5th 19 at 21:35
Solution
parseInt('123.45 ABC');
June 5th 19 at 21:37
Even so.
var s = '123.45 ABC';
var result = s.split('.')[0];
alert(result);

Find more questions by tags JavaScript