New Global Methods

ES6 added 2 new global number methods:

  • isFinite() Method: It checks if a value is a finite number, returning true for numbers, excluding NaN and Infinity.
  • isNaN() Method: It checks if a value is Not-a-Number (NaN), returning true if it’s NaN, false otherwise.

Example: In this example we are using the above-mentioned methods.

Javascript




const var1 = 12;
const var2 = "Geeks";
const var3 = NaN;
const var4 = Infinity;
  
console.log(isFinite(var1));
console.log(isFinite(var2));
  
console.log(isNaN(var1));
console.log(isNaN(var2));
console.log(isNaN(var3));
  
console.log(isFinite(var3));
console.log(isFinite(var4));


Output

true
false
false
true
true
false
false

JS 2015 or ECMAScript 6 (ES6)

JS 2015 (ES6) also known as ECMAScript 6 (ES6), ECMAScript 6 (ES6) is a significant update to JavaScript, introducing arrow functions, classes, template literals, let and const for variable declaration, enhanced object literals, destructuring, and more modern features for better code organization and readability.

Similar Reads

ECMAScript 6 (ES6) New Features

...

Method 1: let and const keyword

JavaScript let is a keyword used to declare variables in JavaScript that are block scoped. JavaScript const for declaring variables with immutable values, enhancing code stability and readability....

Method 2: Arrow Function

...

Method 3: Spread Operator

Arrow functions were introduced in the ES6 version.Arrow functions are anonymous functions i.e. functions without a name and are not bound by an identifier. Arrow functions do not return any value and can be declared without the function keyword. They are also called Lambda Functions....

Method 4: for/of Loop

...

Method 5 : Map Objects

The Spread operator allows an iterable to expand in places where 0+ arguments are expected. It is mostly used in the variable array where there is more than 1 value is expected....

Method 6: Set Objects

...

Method 7: Promises

The for…of loop in JavaScript iterates over iterable objects, like arrays, strings, for concise and readable element access and iteration....

Method 8: ES6 Symbol

...

Method 9: Default Parameters

In JavaScript, a Map object holds key-value pairs, allowing any type of key, unlike objects. It maintains order and provides methods for manipulation and retrieval....

Method 10: Rest Parameter

...

Method 11: String.includes() Method

In JavaScript, a Set object stores unique values of any type. It ensures uniqueness, provides methods for manipulation, and doesn’t allow duplicate values within the set....

Method 12: String.startsWith() and String.endsWith() Methods

...

Method 13: Array methods

Promises in JavaScript manage asynchronous operations, representing eventual results or errors. They simplify handling async code with methods like .then(), .catch(), and allow chaining....

Method 14: New Math Methods

...

Method 15: New Number Methods

ES6 Symbol is a unique, immutable data type used as object property keys, ensuring uniqueness. It’s primarily for internal/private use, avoiding unintended clashes in properties....

Method 16: New Global Methods

...

Method 17: Object Entries

It is used to give the default values to the arguments, if no parameter is provided in the function call....