javascript

How to prevent npm install for unsupported Node.js versions

npm configurations allow us to do quite a lot of nifty things. One of them is to allow the project to set...

Detecting dark mode preference using JavaScript

As dark themes have become popular across the web and across operating systems, we might want to check the user's operating system...

JavaScript: Split string and keep the separators

String.prototype.split() is a valuable method to split strings based on a delimiter. There often comes a scenario when we want to split...

Printing JavaScript stack traces using console.trace

The console object in JavaScript has a lot more useful functions than the most frequently used console.log method. Debugging errors and finding...

Overriding nested dependencies in NPM

Whenever we install a particular package, it is common to come across a problem with a dependency's dependency. With the release of...

Automatic batching in React 18 helps avoid re-rendering

Remember the earlier versions of React that used to batch multiple state updates inside event handlers such as click or change to...

Flatten Arrays in Vanilla JavaScript with flat() and flatMap()

ES2019 introduced two methods on the array prototype that would make life so much simpler for developers. These are flat() and flatmap()...

Using GroupBy on an array of objects in JavaScript

Array grouping is a fairly common operation in any project. Until recently, we had to resort to either writing our own implementation...

Hi there! Want some more knowledge?

Think that the knowledge shared is helpful? You might want to give our mailing list a try. We'll send you 2-4 emails a month, right when new posts come out.

Hi there! Want some more knowledge?

Think that the knowledge shared is helpful? You might want to give our mailing list a try. We'll send you 2-4 emails a month, right when new posts come out.