Created
November 28, 2018 11:32
-
-
Save IamManchanda/f1d93bce7dcd21437525830fe0102612 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 obj = { | |
values: [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34], | |
start: 4, | |
end: 13, | |
*[Symbol.iterator]() { | |
for (var i = this.start; i <= this.end; i++) { | |
yield this.values[i]; | |
} | |
}, | |
}; | |
var myCustomArr = [ ...obj ]; | |
console.log(myCustomArr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment