parseInt() Method - returns a whole number from a string
Fri Jan 10 2020 19:00:00 GMT+0000 (UTC)
Saved by @goblindoom95 #javascript #jsfunctions #numbers
parseInt() parses a string and returns a whole number. Spaces are allowed. Only the first number is returned. If the number cannot be converted, NaN (Not a Number) is returned.
Comments
@juliyvchirkov - Sat Jan 08 2022 13:41:25 GMT+0000 (UTC)one can also use Number() to get a number from a string which contains the only number, like example #1 and #2 above Number('10') /* returns 10 */ Number('10.33') /* returns 10.33 */