Created
September 5, 2017 22:15
-
-
Save nate-getch/d6bdce2d57386a8d60f803ef1234bd6a to your computer and use it in GitHub Desktop.
Spread and Rest Operator in JS ECMA6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var arr = ['nat', 'gat', 'bat']; | |
var arr2 = ['dd','bb', ...arr]; // spread | |
var [a, ...b] = arr; // rest | |
console.log(arr2); // ["dd", "bb", "nat", "gat", "bat"] | |
console.log(a); // nat | |
console.log(b); // ["gat", "bat"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment