Created
September 19, 2019 12:44
-
-
Save sachalifs/f5767e75303ef8824cdafb37f2348440 to your computer and use it in GitHub Desktop.
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
var arr = ['Sacha', 'Og', 'Haru']; | |
arr[Symbol.iterator] = function *() { | |
var i = this.length - 1; | |
while (i >= 0) { | |
yield this[i]; | |
i--; | |
} | |
} | |
for (var value of arr) { | |
console.log(value); | |
} | |
console.log([...arr]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment