NullishCoalesing operator helps us to run our code accurate, Look,
const data = 0;
message = data ?? ‘undefined’;
console.log(message);
You will see the result “0” while “message = data || ‘undefined’ returns “undefined”. #javascript#NullishCoalasing
Spread operator (...) only copies a referencing address. So be careful if you update values in your original object, consequently, newer one has updated values. #JavaScript#SpreadOperator
Non flowing mode is useful for implementing protocols, because it is more flexible to control. See https://t.co/0H9tZixwoW([size]), you can pull the data with fixed size. Moreover, it supports async iterators as well. #Nodejs#nodejssteams#streams#readablestreams
Thanks pipe(), it allows us to connect different processing unit. Only prerequisite is the data type of which is produced by previous method has to supported by next stream. #javascript#Nodejs#nodejsstreams#streams
Early return principal that you have a reduction of nesting level.
“if (err) { return cb(err) } // do something” Anyway, due to return value of async is usually ignored, we can write shortcut like it. #js#javascript#earlyReturnPrinciple#callbackhell
To prevent possible memory leak due to too many listeners, Node provides you a warning when it’s counter is exceeding 10. And you configure it with setMaxListeners() method. #nodejs#js#eventemitter
While process.nextTick runs before any scheduled IO, it can make IO starvation. But it never happens with setImmediate(). This function queues current task in an event loop so that it will run after all IOS have been processed. #js#node#callback
process.nextTick() it is the way of running your sync code working with async. It probably prevents some issues that could be happened due to using sync and async together. Since it push your sync call to the top of the event loop. #js#node