function data(){
return 'Hi Ankit';
return 'Hello Murli'
// not a executable code.
}
var observable = Rx.Observable.create((observer: any) =>{
observer.next('Hi Ankit');
observer.next( 'Hello Murli');
})
observable.subscribe((data)=>{
console.log(data);
})
Output : 'Hi Observable’'
'Hello Murli'
Subscriptions to observables are quite similar to calling a function. But where observables are different is in their ability to return multiple values called streams (a stream is a sequence of data over time).