-
-
Save Babali42/c7a5981b88909e6b43bad715ef2eec74 to your computer and use it in GitHub Desktop.
FizzBuzz is RxJS
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
#!/usr/bin/env node | |
const fizz = "Fizz"; | |
const buzz = "Buzz"; | |
const fizzbuzz = `${fizz}${buzz}`; | |
const Rx = require('rxjs/Rx'); | |
Rx.Observable.range(1,100) | |
.map(n => n % 15 === 0 ? fizzbuzz : (n % 3 === 0 ? fizz : (n % 5 === 0 ? buzz : n))) | |
.subscribe(console.log); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment