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

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -