Number Methods

Published on: September 10, 2016

Welcome to the twelfth Easy JavaScript Tutorial, Beginner JavaScript Tutorial, part of Easy Programming! This tutorial covers Numbers!

Just like strings (and everything else in JS), numbers are also objects and they contain built in methods and properties that you can apply. You can even convert a number to a string and then apply the string methods to it. 

Let's learn JavaScript Number Methods! 

Name Description
MAX_VALUE Property which returns the largest possible number - Number.MAX_VALUE
MIN_VALUE Property which returns the largest possible number - Number.MIN_VALUE
toString() Converts number to String - same as String()
toExponential() Converts number to exponential notation
toFixed() Returns a string with a specified number of decimals
toPrecision() Returns a string with a specified number of digits
parseInt() Attempts to convert data to integer
parseFloat() Attempts to convert data to floating point

To fork the fiddle and follow along: https://jsfiddle.net/easyjs/7voj0ny1/

Remember to checkout the Resources section below for associated downloadable content, JSFiddle links, and other resources. Watch the video and follow along!

Resources:

Comments: