Concurrency in JavaScript Interview Question

🤑 16 LPA Interview Question (Real Experience)🤐 🫡 My friend is an amazing frontend developer. He had an interview last month for a frontend role. He told me that he was asked a question about “concurrency in JavaScript”, and he was required to write code for it (⏳️ 30 min) In short, he had to implement a basic version of p-limit (an npm package with more than 20 crore weekly downloads—you can check it yourself). Honestly, I haven’t encountered this question before.😵💫 Have you? First Question is What does “concurrency” mean?🤔 Every things had a limit of how much work it can handle at a time. (Best way to understand: use the Feynman technique 😌) 🧐 Anology : Imagine 100 people are waiting to give me gifts. I can only handle 2 people at a time, so I allow only 2 people to come forward. While I am processing their gifts (like checking or placing them), others are waiting in a queue. As soon as I finish with one person, I immediately allow the next person from the queue. This way, I am not overwhelmed, but I am also not idle. (You can think of many similar examples) In short ( by AI ) 🤫 A common interview problem is to implement a concurrency limiter (like p-limit), where only a fixed number of async tasks can run at the same time 🫢 * Rephrased by AI * #javascript #frontend #webdevelopment #interviewprep #systemdesign #programming #reactjs #angularjs #nodejs #developers #codinginterview

To view or add a comment, sign in

Explore content categories