1607932910
Ever wanted to be a “Promises whizz”. There are a few tricks you can learn to become that through the use of some promise static methods
On your way to become a “JavaScript Superstar” and “Promises whizz”, you’ll need to master the concept of handling multiple promises at the same time. There are some methods that are provided by the language to do just that, but before we dwell on those methods let’s begin with understanding some basics of “states” and “fates” of promises.
Promises generally have 3 possible mutually exclusive states, they are:
promise.then(f)
will call f
as soon as possiblepromise.then(undefined, r)
will call r
“as soon as possible.”An umbrella term, commonly used, for the above would be “settled” where a promise is said to be “settled” if it is not pending (that is if it is either fulfilled or rejected).
Promises have two possible mutually exclusive fates, they are:
Now that we have covered the concept of states and fates, we should now be able to understand promise concepts with common terminology. Let’s move on to the gist of the article.
#javascript #programming #developer
1590928341
Promise.allSetlled() is recently introduced in ECMA 2020.
Check out how it is different from Promise.all()
https://www.geekstutorialpoint.com/2020/05/promiseallsettled-vs-promiseall.html
#javascript #promise.all #promise.allsettled #ecma #promise #jquery
1602406920
Promises in JavaScript are used to handle asynchronous operations by keeping track of whether a certain event has happened. If that certain event has taken place, it determines what happens next. Promises return a value which is either a resolved value or a reason why it’s rejected. They can handle multiple asynchronous operations easily and they provide better error handling than callbacks and events.
Callback: A callback is a function that is passed into another function as an argument to be executed later.
Events: Events provide a dynamic interface to a WebPage and are connected to elements in the Document Object Model(DOM), for example: onclick(), onmouseover() etc.
Pending: Before the event has happened, the promise is in the pending state.
Settled: Once the event has happened it is then in the settled state.
Fulfilled: Action related to the promise has succeeded.
Rejected: Action related to the promise has failed.
#javascript #javascript-development #javascript-tutorial #promises #javascript-tips
1591912500
In this video, we are going to go over promises and three different promise methods that you can use when writing JavaScript or Node code.
#javascript #race #allsettled
1607932910
Ever wanted to be a “Promises whizz”. There are a few tricks you can learn to become that through the use of some promise static methods
On your way to become a “JavaScript Superstar” and “Promises whizz”, you’ll need to master the concept of handling multiple promises at the same time. There are some methods that are provided by the language to do just that, but before we dwell on those methods let’s begin with understanding some basics of “states” and “fates” of promises.
Promises generally have 3 possible mutually exclusive states, they are:
promise.then(f)
will call f
as soon as possiblepromise.then(undefined, r)
will call r
“as soon as possible.”An umbrella term, commonly used, for the above would be “settled” where a promise is said to be “settled” if it is not pending (that is if it is either fulfilled or rejected).
Promises have two possible mutually exclusive fates, they are:
Now that we have covered the concept of states and fates, we should now be able to understand promise concepts with common terminology. Let’s move on to the gist of the article.
#javascript #programming #developer
1624959720
What a mess it could be to share the same name — especially if you are a programming language. Even if you are already over 20 years old, IT newbies periodically confuse you with your namesake. This happens all the time with Java and JavaScript, although they are not related at all! As someone on the internet said. They correlate in much the same way as a car and a carpet.
Why do these two languages have such similar names? How do they differ from each other, and what else do they have in common? This article will provide the answers to these questions.
…
#java #javascript #javascript-development #java-development #learn-to-code-java #learn-javascript #programming #java-vs-javascript