Tips for Golfing in ECMAScript 6 and above This is similar to other "Tips for golfing in &lt;...>" but specifically targeting the newer features in JavaScript brought up in ECMAScript 6 and above.

JavaScript inherently is a very verbose language, function(){}, .forEach(), converting string to array, array-like object to array, etc, etc are super bloats and not healthy for Golfing.

ES6+, on the other hand, has some super handy features and reduced footprint. x=&gt;y, [...x], etc. are just some of the examples.

Please post some nice tricks that can help shave off those few extra bytes from your code.

NOTE: Tricks for ES5 are already available in Tips for golfing in JavaScript; answers to this thread should focus on tricks only available in ES6 and other future ES versions.

However, this thread is also for users who currently golf using ES5 features. Answers may also contain tips to help them understand and map ES6 features to their style of ES5 coding.
Spread operator ...

The spread operator transforms an array value into a comma separated list.

Use case 1:

Directly use an array where a function expects a list

list=[1,2,3]
x=Math.min(...list)
list=[10,20], a.push(...list) // similar to concat()


Use case 2:

Create an array literal from an iterable (typically a string)

[...'buzzfizz'] // -&gt; same as .split('')


Use case 3:

Declare a variable number of arguments for a function

F=(...x) =&gt; x.map(v =&gt; v+1)
// example: F(1,2,3) == [2,3,4]


See mozilla doc