Skip to content

Instantly share code, notes, and snippets.

@titarenko
Created May 21, 2017 12:49
Show Gist options
  • Select an option

  • Save titarenko/da8e40e66c439ec869346f5c537bbd1e to your computer and use it in GitHub Desktop.

Select an option

Save titarenko/da8e40e66c439ec869346f5c537bbd1e to your computer and use it in GitHub Desktop.
fizzbuzz for jsers
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)
}
}
}
@titarenko
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment