Asynchronous JavaScript: Using the Promise.all and Promise.race Static Methods
HTML-код
- Опубликовано: 21 авг 2018
- In this final tutorial on JavaScript promises we will take a look at the all and race static methods. They allow you to work with multiple promises at that same time.
For more resources on JavaScript:
www.allthingsjavascript.com
Full personalized courses on JavaScript:
allthingsjavascript.com/person...
Special offer on courses: allthingsjavascript.com/course...
Tutorials referred to in this video:
JavaScript Promises Playlist: • Understanding Asynchro...
Boss your contents are great!!!
Thank you!
this are the best tutorials for js ,
Very helpful and clear tutorials
Thank you!
Great like always thank you so much . I have a question out of context but if you can answer anyway please. Is there any problem in run npm install -g more than one time the same library? If yes what is the worst that can happen?
There shouldn't be a problem with doing that. Here is a good article on npm issues that you might find helpful: medium.com/@jacob.h.page/common-npm-mistakes-51bf8989079f
Great video as always!
I have a question here as well I hope you don't mind answering it.
In case of race method if either of the promise is resolved or rejected what's happens to others? Are they terminated? Or the execution of the race stops then and there?
Promises can't be cancelled, so basically they are silently ignored.
@@AllThingsJavaScript I was asking if race method finds anyone of them as fulfilled then will the engine go and parse other promises or will exit right away?
@@akshay__sood If one is fulfilled, it ignores the other promises. The other promises are allowed to run to the end as I understand it. Eventually they are garbage collected. Does that help?
@@AllThingsJavaScript your replies always help!
Also in all method I thought when all of them are fulfilled then only it returns output but it outputs only one promise also if either of them are fulfilled.
I believe for all to be fulfilled we have allSettled.
@@akshay__sood Promise.all for settling all of them.
sir I am beginner.
var passed=1;
function globalfun(){
var inner=4;
console.log(passed+inner);
}
console.dir(globalfun);
myQ:when I am executing in chrome console there is no closure in last statement.
but it showing closure in jsfiddle.net of window object(passed). is it closure or not???
pls provide correct definition sir
Your not really using closure. passed is just a global variable. I think this tutorial that I have done explains closure best: ruclips.net/video/TznpOmv2BQM/видео.html
I m sure you might have found the answer but if in case...
As far as i know the whole code you write in JS Fiddle is executed in a function so basically the variable that appears to be in a global scope to console is actually a part of a function in JS Fiddle.
Hope that helps!