Get the latest tech news
A Guide to Destructuring in JavaScript
Mat “Wilto” Marquis walks us through JavaScript destructuring, the rest operator and spread operator in a jam-packed guide.
In its simplest form — called “binding pattern destructuring” — each value is unpacked from the array or object literal and assigned to a corresponding identifier, all of which are initialized with a single let or const(or var, I suppose, if you’re feeling nostalgic for function-scoping). All told, the destructuring assignment provides you with a quick and convenient way to break down complex data structures, but it definitely isn’t the most approachable syntax for how dense it is. You’ll most frequently run into the rest operator (...) in a destructuring assignment, but like an indecisive text-messager, JavaScript is going to present you with ellipses in a few unexpected places.
Or read this on Hacker News