
Destructuring in JavaScript(beginner to advance)
If you know JavaScript then you must have used an object and array. In object you use dot(.) notation to access values from an object. And it array we use bracket [] to access the values. But when you use object dot(.) notation and [] many times in code . It makes our code unreadable. Code Example : Without destructuring const user = { name : " John " , age : 20 , city : " Mumbai " }; const name = user . name ; const age = user . age ; const city = user . city ; console . log ( name , age , city ); What destructuring means : Destructuring is a JavaScript syntax that introduce in ES6 that allow us to extract values from object into variable without using dot(.) notation and brackets. It makes our code more readable and clean. With destructuring const user = { name : " John " , age : 20 , city : " Mumbai " }; const { name , age , city } = user ; console . log ( name , age , city ); Object Destructuring : Object destructuring use braces {} to match property key from an object. Basic Assig
Continue reading on Dev.to Beginners
Opens in a new tab


