Last active
December 19, 2016 17:55
-
-
Save imaustink/5fe30fc838d10dba0c7d9b4e651d8ed4 to your computer and use it in GitHub Desktop.
ES6 is fun
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
class Pages extends Array{ | |
constructor(){ | |
super().push.apply(this, arguments); | |
this.i = 0; | |
} | |
get next(){ | |
return this[this.i++]; | |
} | |
} | |
var p = new Pages(1,2,3,4,5,6,7,8,9,10); | |
p.next; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment