skip to Main Content

Javascript – Are Observables not really asynchronous?

I'm surprised by the order of the output of this Observable example: <script type="module"> import { of } from 'https://dev.jspm.io/rxjs@6'; console.log("1. before subscribe"); of(["asd"]).subscribe(paramMap => { console.log("2. in subscribe"); }); console.log("3. after subscribe"); </script> This produces this output: 1. before…

VIEW QUESTION

Javascript – Order of operations with subscription

I have code like this: get dislpayHello(): boolean { let result = false; console.log('start'); let observable = of(true); observable.subscribe((display) => { console.log('set value'); result = true; }); console.log('finish'); return result; } StackBlitz I always thought that, whatever callback we put…

VIEW QUESTION
Back To Top
Search