Are these constructions the same?
const {PI} = Math;
and
const PI = Math.PI;
What are benefits of using the first example?
Are these constructions the same?
const {PI} = Math;
and
const PI = Math.PI;
What are benefits of using the first example?
The curly braces around the variable name is called Destructuring assignment,
and const {PI} = Math;
will translate to const PI = Math.PI
It is a so-called "destructuring assignment".
Searching this site I found a similar question with a good answer: Javascript (ES6) const with curly braces