We have already had the chance to use this operator a few times. It takes an unknown number of comma-separated arguments, which can be integers, strings, or objects. This is an operator you want to use if you just want to emit a limited set of values. To use it, simply type:
// creation-operators/of.jsconst numberStream$ = Rx.Observable.of(1,2, 3);const objectStream$ = Rx.Observable.of({ age: 37 }, { name: "chris" });// emits 1 2 3numberStream$.subscribe(data => console.log(data));// emits { age: 37 }, { name: 'chris' }objectStream$.subscribe(data => console.log(data));
As can be seen from the code, it really doesn't matter what we place in our of() operator, it is able to emit it anyway.