Skip to content

Instantly share code, notes, and snippets.

View abhishekdubey1's full-sized avatar

Abhishek Dubey abhishekdubey1

View GitHub Profile
@montanaflynn
montanaflynn / CONCURRENCY.md
Last active November 7, 2024 18:22
Examples of sequential, concurrent and parallel requests in node.js

Concurrency in JavaScript

Javascript is a programming language with a peculiar twist. Its event driven model means that nothing blocks and everything runs concurrently. This is not to be confused with the same type of concurrency as running in parallel on multiple cores. Javascript is single threaded so each program runs on a single core yet every line of code executes without waiting for anything to return. This sounds weird but it's true. If you want to have any type of sequential ordering you can use events, callbacks, or as of late promises.