rxjs change observable code example
Example 1: emit new value observable
const observable = new BehaviorSubject("initial value");
observable.subscribe({
next: (value) => console.log("The value is: ", value)
});
observable.next("a new value");
Example 2: create an observabloe js
content_copy
open_in_new
function foo() {
console.log('Hello');
return 42;
}
const x = foo.call(); // same as foo()
console.log(x);
const y = foo.call(); // same as foo()
console.log(y);