Assign value to multiple variables at once in Javascript
Beginner Developer

Beginner Developer @beginnerdeveloper

About: Hello! I am Muhammad Ejaaz Razzak Khan, a Software Developer.

Location:
Mumbai
Joined:
Mar 9, 2021

Assign value to multiple variables at once in Javascript

Publish Date: Aug 24 '21
10 0

The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from objects, into distinct variables.

    let [a,b,c] = [1,2,3];

    console.log(a,b,c);
Enter fullscreen mode Exit fullscreen mode

Output:

Output
My Blog:- https://beginners-developer.blogspot.com/
Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

Comments 0 total

    Add comment