Created
May 21, 2017 12:49
-
-
Save titarenko/da8e40e66c439ec869346f5c537bbd1e to your computer and use it in GitHub Desktop.
fizzbuzz for jsers
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
| const Promise = require('bluebird') | |
| Promise.mapSeries( | |
| new Array(100), | |
| (x, i) => Promise.resolve(numberToString(i + 1)) | |
| .then(console.log) | |
| .delay(50) | |
| ) | |
| function numberToString (i) { | |
| if (i % 3 == 0) { | |
| if (i % 5 == 0) { | |
| return 'misskiss' | |
| } else { | |
| return 'miss' | |
| } | |
| } else { | |
| if (i % 5 == 0) { | |
| return 'kiss' | |
| } else { | |
| return String(i) | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
compare with what author declares as correct answer (well, functionally that's correct, but non-functionally according to my standards - not)
full article (RU) is here