The Math.log10(x) method returns the logarithm of x to the base 10.
Math.log10(10); // returns 1 |
ES6 introduced the following properties to the Number object:
let x = Number.EPSILON; |
let x = Number.MIN_SAFE_INTEGER; |
let x = Number.MAX_SAFE_INTEGER; |
The Number.isInteger() method checks whether a given value is an integer.
Number.isInteger(10); // returns true Number.isInteger(10.5); // returns false |
A safe integer is an integer that can be precisely represented as a double-precision number.
The Number.isSafeInteger() method returns true if the given argument is a safe integer.
Number.isSafeInteger(10); // returns true Number.isSafeInteger(12345678901234567890); // returns false |
Safe integers range from -(2^53 – 1) to +(2^53 – 1). For example, 9007199254740991 is a safe integer, while 9007199254740992 is not. |
ES6 introduced two new global number methods:
The global isFinite() method returns false if the argument is Infinity or NaN; otherwise, it returns true.
isFinite(10/0); // returns false isFinite(10/1); // returns true |
The global isNaN() method returns true if the argument is NaN; otherwise, it returns false.
isNaN(“Hello”); // returns true |
Modules can be imported in two different ways:
Import specific exports from the person.js file:
import { name, age } from “./person.js”; |
Import the default export from the message.js file:
import message from “./message.js”; |