0

Queues in Node js

 2 years ago
source link: https://dev.to/sudonitin/queues-in-node-js-4359
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Queues in Node js

Have you been using node js for a while now? Are you aware of how things work internally in node js? the queues in node js? Doesn’t matter if your answer is yes or no, I will let you in on one little secret which will clear all your doubts regarding how node js works asynchronously under the hood.

Let’s test your knowledge on node js. If you understand the queues in node js, you would be able to solve the below question.

console.log("1");
setTimeout(() => console.log("2"),0);
var promise = new Promise(function(resolve, reject) {
resolve();
});
promise.then(function(resolve) {
console.log('3');
})
.then(function(resolve) {
console.log('4');
});
console.log("5");

Like what you read?

Read the full article on readosapien.com

Article link


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK