Skip to Content
Learning JavaScript Data Structures and Algorithms - Third Edition
book

Learning JavaScript Data Structures and Algorithms - Third Edition

by Loiane Avancini
April 2018
Beginner to intermediate content levelBeginner to intermediate
426 pages
10h 19m
English
Packt Publishing
Content preview from Learning JavaScript Data Structures and Algorithms - Third Edition

Exponentiation operator

The exponentiation operator may come in handy when working with math. Let's use the formula to calculate the area of a circle as an example:

const area = 3.14 * r * r; 

We could also use the Math.pow function to write the same code:

const area = 3.14 * Math.pow(r, 2); 

ES2016 introduced **, where ** is designed to be the new exponentiation operator. We can calculate the area of a circle using the exponentiation operator as follows:

const area = 3.14 * (r ** 2); 
This example can be executed at https://goo.gl/Z6dCFB.

ES2015+ also has some other functionalities; among them, we can list iterators, typed arrays, Set, Map, WeakSet, WeakMap, tail calls, for..of, Symbol, Array.prototype.includes, trailing commas, string padding, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning JavaScript Data Structures and Algorithms

Learning JavaScript Data Structures and Algorithms

Loiane Avancini

Publisher Resources

ISBN: 9781788623872Supplemental Content