Web Development

Printing JavaScript stack traces using console.trace

Printing JavaScript stack traces using console.trace

  • January 26, 2022

The console object in JavaScript has a lot more useful functions than the most frequently used console.log method. Debugging errors and finding execution flow can be a lot easier by making use of the console.trace method. It allows us to print the current stack trace where the method was called....

Overriding nested dependencies in NPM

Overriding nested dependencies in NPM

  • January 18, 2022

Whenever we install a particular package, it is common to come across a problem with a dependency’s dependency. With the release of npm 8.3, an overrides attribute has been added to solve this problem and allow overriding of nested dependencies in NPM. The problem Let us say your project depends...

Automatic batching in React 18 helps avoid re-rendering

Automatic batching in React 18 helps avoid re-rendering

  • January 13, 2022

Remember the earlier versions of React that used to batch multiple state updates inside event handlers such as click or change to avoid multiple re-renders? React 18 has added automatic batching for all use cases to improve that performance optimization even further. With React 18, state updates in event handlers,...

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

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

  • January 5, 2022

ES2019 introduced two methods on the array prototype that would make life so much simpler for developers. These are flat() and flatmap() which help in flattening arrays. Array.prototype.flat() As the name suggests, the flat() method returns a new array with elements of the subarray flattened into it, that is the...

Using GroupBy on an array of objects in JavaScript

Using GroupBy on an array of objects in JavaScript

  • December 29, 2021

Array grouping is a fairly common operation in any project. Until recently, we had to either write our own implementation or use third-party libraries when wanting to GroupBy on an array of objects in JavaScript. That will soon no longer be needed since a native implementation has been introduced in...

Node.js introduces node: protocol imports

Node.js introduces node: protocol imports

  • December 23, 2021

Node.js recently introduced a node: protocol for built-in modules. Built-in node modules can now be imported by prefixing the node: protocol prefix. So, what previously used to be can now be imported as Benefits It is currently supported:

JSON Modules in JavaScript

JSON Modules in JavaScript

  • December 8, 2021

ES Modules were introduced in ES2015. The import and export keywords by default are only applicable to JavaScript code. But there is a new proposal to allow it to be used for JSON modules in JavaScript. It is convenient to keep some configuration inside a JSON file and import that....

How to check if a string contains emojis in JavaScript?

How to check if a string contains emojis in JavaScript?

  • December 1, 2021

If you have user-generated content in your web application, chances are you have to deal with strings containing emojis. Since emojis are stored as Unicode, chances are that we want to detect these in our code and then render them accordingly. This article discusses how we can check if a...