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

0

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

+1

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: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt https://www.w3schools.com/jsref/jsref_parseint.asp