ES6 Ninja Moves

Array and object manipulation with clarity and style

Chuánqí Sun
1 min readFeb 16, 2018
ES6 syntax won’t help you slaughter the python, but it will be your productivity booster [1]

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!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Chuánqí Sun
Chuánqí Sun

Written by Chuánqí Sun

UX experimentalist | space-time pattern recognizer | https://chuanqisun.com

No responses yet

Write a response