javascript

How to write more readable JavaScript conditionals

One of the practices of clean code is to make it more readable. And a fairly common use case in…

2 years ago

Deep copying in JavaScript using structuredClone

For as long as anyone can remember, deep copying in JavaScript was not a built-in feature and we had to…

2 years ago

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…

2 years ago

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…

2 years ago

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…

2 years ago

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…

2 years ago

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…

2 years ago

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…

2 years ago
Advertisements