Web Development

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…

3 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…

3 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…

3 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…

3 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…

3 years ago

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()…

3 years ago

Using GroupBy on an array of objects in JavaScript

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

3 years ago

Node.js introduces node: protocol imports

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

3 years ago

JSON Modules in JavaScript

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

3 years ago

How to check if a string contains emojis in JavaScript?

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

3 years ago
Advertisements