An Interest In:
Web News this Week
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
- March 14, 2024
August 24, 2021 04:50 pm GMT
Original Link: https://dev.to/beginnerdeveloper/assign-value-to-multiple-variables-at-once-in-javascript-3ah7
Assign value to multiple variables at once in Javascript
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);
Output:
My Blog:- https://beginners-developer.blogspot.com/
Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
Original Link: https://dev.to/beginnerdeveloper/assign-value-to-multiple-variables-at-once-in-javascript-3ah7
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To