Quick Reference
This is a quick reference list of JavaScript number methods and properties with examples of how they are used.
- JavaScript – Number constructor PropertyThe Number constructor property returns the function that created the Number prototype.
- JavaScript – Number.isFinite() MethodThe Number.isFinite() method returns true if a number is finite (not Infinity, -Infinity, or NaN).
- JavaScript – Number.isInteger() MethodThe Number.isInteger() method returns true if a value is an integer of the datatype Number.
- JavaScript – Number.isNaN() MethodThe Number.isFinite() method returns true if the value is NaN (not a number), yet the type is a Number.
- JavaScript – Number.isSafeInteger() MethodThe Number.isFinite() method returns true if a number is a safe integer, and also of a Number data type.
- JavaScript – Number.MAX_VALUE PropertyThe Number.MAX_VALUE property returns the largest possible number in JavaScript, which is 1.7976931348623157e+308.
- JavaScript – Number.MIN_VALUE PropertyThe Number.MIN_VALUE property returns the smallest possible number in JavaScript, which is 5e-324.
- JavaScript – Number.NaN PropertyThe Number.NaN property returns NaN (Not a Number).
- JavaScript – Number.NEGATIVE_INFINITY PropertyThe Number.NEGATIVE_INFINITY property returns negative infinity.
- JavaScript – Number.POSITIVE_INFINITY PropertyThe Number.POSITIVE_INFINITY property returns positive infinity.
- JavaScript – Number.prototype PropertyThe Number.prototype property allows the addition of new properties and methods to numbers.
- JavaScript – Number toExponential() MethodThe Number toExponential() method converts a number into exponential notation.
- JavaScript – Number toFixed() MethodThe Number toFixed() method converts a number to a string, while rounding the string to a specified number of decimals.
- JavaScript – Number toLocaleString() MethodThe Number toLocaleString() method returns a number as a string, using locale settings.
- JavaScript – Number toPrecision() MethodThe Number toPrecision() method formats a number to a specified length, adding a decimal point and zeroes if necessary to achieve the length.
- JavaScript – Number toString() MethodThe Number toString() method returns a number as a string.
- JavaScript – Number valueOf() MethodThe Number valueOf() method returns the primitive value of a number.
JavaScript Notes:
- When using JavaScript, single or double quotation marks are acceptable and work identically to one another; choose whichever you prefer, and stay consistent
- JavaScript is a case-sensitive language; firstName is NOT the same as firstname
- Arrays count starting from zero NOT one; so item 1 is position [0], item 2 is position [1], and item 3 is position [2] … and so on
- JavaScript variables must begin with a letter, $, or _
- JavaScript variables are case sensitive (x is not the same as X)
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.