Created
December 27, 2015 17:30
-
-
Save naush/27179c381a994256a44d to your computer and use it in GitHub Desktop.
ES6 Generator example
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
| *range (begin, end, interval = 1) { | |
| for (let number = begin; number <= end; number += interval) { | |
| yield number | |
| } | |
| } | |
| let hours = [...this.range(0, 360, 30)] // [0, 30, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment