![Convert a string to a number](https://javascriptsource.com/wp-content/uploads/2022/02/Convert-a-string-to-a-number-702x526.jpg)
Convert a string to a number.
Sometimes it returns integer. Other times it returns a float. And if you pass in a string with random text in it, you’ll get NaN
, an acronym for Not a Number.
// returns 123
Number('123');
// returns 12.3
Number('12.3');
// returns NaN
Number('3.14someRandomStuff');