Definition of parseInt | Sololearn: Learn to code for FREE!


Definition of parseInt

Can someone tell me an easy explanetion of parseInt in JavaScript? Thanks

4/1/2020 5:43:35 PM

carloalberto lupo

1 Answer

New Answer


parseInt is a function that takes a string and tries to convert that string to a number. Example: a = parseInt("4.25"); /* This converts the string "4.25" to a number 4.25 and it is stored in 'a' */ a = parseInt("abc"); /* You cannot convert the string "abc" to number, 'a' will be NaN (this means "It is Not a Number") */ Useful links: