Created
December 17, 2013 16:41
-
-
Save Kuniwak/8008021 to your computer and use it in GitHub Desktop.
CodeBattleのFizzBuzzで書いた変態回答。最新の狐のscript[type=application/javascript;version=1.7]が必要。
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 Range = function(start, end) { | |
[this.start, this.end] = start <= end ? [start, end] : [end, start]; | |
}; | |
Range.prototype.__iterator__ = function() { | |
for (var i = this.start; i <= this.end; i++) yield i; | |
}; | |
for (var i in new Range(1, 100)) { | |
console.log(i % 3 ? i % 5 ? i : 'Buzz' : i % 5 ? 'Fizz' : 'FizzBuzz'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment