JS 2016 or ECMAScript 2016
Last Updated :
01 Sep, 2023
JavaScript 2016 (ES2016) is a modified version of ES2015 in which they introduced some new features like JavaScript Exponentiation (**) operator, JavaScript Exponentiation assignment (**=), and Array..includes() method for array element presence checking, enhancing calculations, and array operations, JavaScript 2016 is also known as ECMAScript 2016.
JS 2016 Introduces Three New Features
- JavaScript Exponentiation (**)
- JavaScript Exponentiation assignment (**=)
- JavaScript Array includes()
We will explore all the above methods along with their basic implementation with the help of examples.
JavaScript exponentiation (**) is an operator that raises the left operand to the power of the right operand, simplifying mathematical calculations and providing a concise way to perform power operations.
Syntax:
num1 ** num2
Example: In this example, we are calculating the square and cube of our given number by using JavaScript Exponentiation (**).
Javascript
let num1 = 5;
let num2 = 2;
let result = num1 ** num2;
console.log(result);
let result2 = 3 ** 3;
console.log(result2);
|
JavaScript’s exponentiation assignment (**=) operator updates a variable by raising its value to the power of another.
Syntax:
num1 **= num2
Example: In this example we are using the Exponentiation assignment (**=).
Javascript
let num1 = 2;
let num2 = 3;
num1 **= num2;
console.log(num1);
|
Array.includes() is a method that checks if an element is present in an array, returning boolean value, true if found, false otherwise.
Syntax:
array.includes(searchElement, start)
Example: In this example we are using array includes to find specific element on our given array.
Javascript
let languages = [ 'HTML' , 'CSS' , 'JavaScript' , 'React.js' ];
let search1 = 'HTML' ;
let search2 = 'Node.js' ;
console.log(languages.includes(search1));
console.log(languages.includes(search2));
|
Share your thoughts in the comments
Please Login to comment...