Created
June 28, 2018 13:23
-
-
Save sedera-tax/38af8c563bf40126f840840c99f60de7 to your computer and use it in GitHub Desktop.
Spread operator ES6
This file contains hidden or 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
| function copyMachine(arr, num) { | |
| let newArr = []; | |
| while (num >= 1) { | |
| newArr.push([...arr]); | |
| num--; | |
| } | |
| return newArr; | |
| } | |
| // change code here to test different cases: | |
| console.log(copyMachine([true, false, true], 2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment