Consider the declarations of variable "x" and "y"
const x = 1;
const [y] = [1]
What is the meaning of 2nd declaration? Can someone suggest an article about such declaration type.
Consider the declarations of variable "x" and "y"
const x = 1;
const [y] = [1]
What is the meaning of 2nd declaration? Can someone suggest an article about such declaration type.
This is destructuring assignment.
You are unpacking values from arrays or object properties.
In your above code, a const
variable y
will be defined with value 1.