Detecting dark mode preference using JavaScript

3 years ago

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

JavaScript: Split string and keep the separators

3 years ago

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

Printing JavaScript stack traces using console.trace

3 years ago

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

Overriding nested dependencies in NPM

3 years ago

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

Automatic batching in React 18 helps avoid re-rendering

3 years ago

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

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

3 years ago

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

Using GroupBy on an array of objects in JavaScript

3 years ago

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

Node.js introduces node: protocol imports

3 years ago

Node.js recently introduced a node: protocol for built-in modules. Built-in node modules can now be imported by prefixing the node:…

JSON Modules in JavaScript

3 years ago

ES Modules were introduced in ES2015. The import and export keywords by default are only applicable to JavaScript code. But…

How to check if a string contains emojis in JavaScript?

3 years ago

If you have user-generated content in your web application, chances are you have to deal with strings containing emojis. Since…

Advertisements