JavaScript

How to remove a property from a JavaScript object

How to remove a property from a JavaScript object

  • August 29, 2021

There are two ways to remove a property from a JavaScript object: one is the mutable way of doing it by using the delete operator. And the second one is the immutable way of doing it by using object restructuring. Let us go through each of these: 1. The delete...

Measuring JavaScript execution time

Measuring JavaScript execution time

  • July 1, 2021

When it comes to performance of applications, measuring performance becomes important. For anything to be optimized, it must be measured first, optimized, and measured again to capture gains. Measuring JavaScript execution time thus becomes one of these steps. Modern browsers and the Node.js platform provide various API’s to measure code...

Numeric Separators in JavaScript

Numeric Separators in JavaScript

  • June 16, 2021

Writing performant code is not enough as a developer. We need to ensure that it is readable as well. And it is rare that an API change in a language introduces readability. Numeric Separators are one such rare change. Why numeric Separators? Reading this takes a few seconds: Counting the...

Apply timeout to JavaScript Promises

Apply timeout to JavaScript Promises

  • June 10, 2021

JavaScript promises do not have any time associated with them. We can use a .then() function and wait until the promise is resolved or rejected. We can even await it, and either of those works if the async task finishes in a reasonable amount of time. But in the case...

Enforcing coding standards using husky pre-commit hooks

Enforcing coding standards using husky pre-commit hooks

  • June 5, 2021

Having consistency and enforcing coding standards becomes very important as an application scales. It becomes important to automate the process to ensure quality standards and make the application maintainable. ESLint and Prettier can be used to define these standards, but we also need a tool to enforce them. Husky provides...

Writing better conditional expressions in JavaScript

Writing better conditional expressions in JavaScript

  • March 30, 2021

Writing conditional expressions is pretty easy to do. But there is room for improvement in the way we have been doing it. And with the flexibility that JavaScript provides, we can replace conditionals with clean code by using some good practices. And it can lead to more maintainable code. Let...

Using the optional chaining operator in JavaScript

Using the optional chaining operator in JavaScript

  • March 18, 2021

Every now and then, you come across a JavaScript feature that vastly changes the way you write it. Destructuring, arrow functions, modules have been some of those features for me. Optional chaining is going to be the next one on that list for me. Optional Chaining is in stage 4...