Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

My First Playground

node v8.17.0
version: 1.0.0
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
const { Subject } = require('rxjs'); const { map } = require('rxjs/operators'); const sub = new Subject(); const emits = []; const emit$ = sub.asObservable().subscribe(x => emits.push(x)); const data$ = sub.asObservable().pipe( map(x => { if (x % 2 === 0) { sub.next(2333); } if (x === 2333) { sub.next(1111); } return x; }) ); const datas = []; data$.subscribe(x => { datas.push(x); }); sub.next(1); sub.next(2); setTimeout(() => { console.log('emits: ',emits); console.log('datas: ', datas); }, 10);
Loading…

no comments

    sign in to comment