This content originally appeared on DEV Community and was authored by Beginner Developer
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
This content originally appeared on DEV Community and was authored by Beginner Developer
Beginner Developer | Sciencx (2021-08-24T16:50:52+00:00) Assign value to multiple variables at once in Javascript. Retrieved from https://www.scien.cx/2021/08/24/assign-value-to-multiple-variables-at-once-in-javascript/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.