The word

Type Conversion

In JavaScript, we sometimes need to convert from one type to another. We can use a toDtring method to convert to a string. To convert to numbers, we can use parseInt and parseFloat. The biggest difference between the two is that parseFloat deals with decimal points. Each one of the methods returns the numbers of the item until it hits an alpha character Then is stops. For example…


The log statement outputs the number 123 to the console.

Happy Coding!

Clay Hess

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email
Skip to content