rxjs - is Observable.toPromise and Observable.last().subscribe are identical -


are 2 line of code identical in performance

observable.range(1,5).topromise().then(res => console.log(res)) 

vs

observable.range(1,5).last().subscribe(res => console.log(res)) 

if the documentation of topromise() find identical

return new promise((resolve, reject) => {     let value;     this.subscribe((x) => value = x, (err) => reject(err), () => resolve(value)); }); 

Comments

Popular posts from this blog

service - Android MediaPlayer calls onCompletion before it already finished -

javascript - Training Neural Network to play flappy bird with genetic algorithm - Why can't it learn? -

asp.net mvc - how to pass 'true'/'false' data from Controller to View using jquery for bootstrap validator in MVC -