Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fizzbuzz.js
// need rx.all.js
let source = Rx.Observable.range(1, 100);
let hot = source.publish();
hot.where(function (c) {
return c % 3 === 0;
}).subscribe(function (e) {
console.log("Fizz")
})
hot.where(function (c) {
return c % 5 === 0
}).subscribe(function (e) {
console.log("Buzz")
})
hot.where(function (c) {
return (c % 3 !== 0) && (c % 5 !== 0)
}).subscribe(function (e) {
console.log(e)
})
hot.connect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment