Node.js Essentials: Master the “require()” Function by Constructing a Homemade Module Loader
What is a module? A module is a block of code in a file. Modules…
Two ways to determine if one string is a permutation of another
Two ways to determine if one string is a permutation of another.
1. Sorting and Comparing
2….
4 ways to determine if a string has all unique characters
4 ways to determine if a string has all unique characters:
1. Use nested loops
2. Sorting…
3 ways to Run CPU Bound tasks in Node.js
TL;DR:
1. Use setImmediate
2. Delegate to a child process
3. Delegate to a worker thread
The reactor pattern
The reactor pattern is the heart of Node.js. It is a specialisation of the previously…
Why do we need an event loop?
Operating systems provide another native mechanism to handle concurrent, non-blocking resources efficiently. This mechanism is…