How to use ECMAScript2016 new syntax.

Last year, ECMAScript2015 is really usefult and help our environment. However, this year is 2016…yes, ECMAScript2015 over, it will release every year about new syntax. today, I describe such as new syntax.

New syntax

New syntax that have been added to the ECMAScript2016 is below 2 syntax.

Exponentiation Operator

Let’s see the behavior respevtively!


Array.prototype.includes() find in the array. Until now, I think, if we search in the array, we used indexOf. However, Array.prototype.includes() is more useful than indexOf.

console.log([1, 2, 3].includes(2))
const arr = ['Miranda', 'John', 'Milla'];

it is return as bool. Compared with the old syntax, it is really smart.

Exponentiation Operator

Exponentiation Operator is raising a number to a power.

let num = 4 ** 2; // 16
let sample = 3;
sample **= 3;
console.log(sample); // 27

above sample is same below.

Math.pow(4, 2) //16
Math.pow(3, 3) //27


ECMAScript2016 new syntax type is a few and learn easy. In particular, Array.prototype.includes() is really convenient. I want to often use that.

thank you for reading! and see you next time!