ES6 Ninja Moves
Array and object manipulation with clarity and style
According to The State of JavaScript 2017 report, ES6 has already become the most used JavaScript flavor. Whether you code JSX with React or TypeScript with Angular, most of the ES6 features are already available at your fingertip. In this post, let’s leverage the ES6 features to manipulate array and object with clarity and style.
ES6 introduces four syntax features: spread, rest parameter, destructuring assignment, object shorthand and object property deduplication. Let’s use some examples to illustrate each feature:
Spread
Rest parameters
Destructuring assignment
Object shorthand and property deduplication
Put them together
Now that we understand how spread, rest parameters, destructuring assignment, object shorthand, and object property deduplication work, let’s put them together to create useful shortcuts for our daily tasks:
That’s it! Feel free to reply any tips and tricks that you would like to share, and any questions or comments about my post. Thank you and happy hacking!