JavaScript

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...

Retrieving content value of ::after or ::before in JavaScript

Retrieving content value of ::after or ::before in JavaScript

  • November 21, 2021

Let us suppose we had an HTML element which had an ::after property assigned to it. We are going to be retrieving the content value of ::after or ::before of this element using JavaScript. For the following element: If we needed a way of retrieving content value of ::after in...

How to create a UUID in JavaScript

How to create a UUID in JavaScript

  • September 30, 2021

Creating a globally unique identifier has always been a necessity in all programming languages and for some reason, JavaScript never had a way of doing it in the default spec. But that is changing now with the crypto API. We can now create a UUID in JavaScript. What is UUID/GUID?...

Specifying a node version in Repl.it

Specifying a node version in Repl.it

  • September 13, 2021

I was recently trying to use a later version of Node on Repl.it. I wanted to use a package that supported ES Modules, and the default version did not have support for it. So I wanted to use the latest node version in Repl.it. And found that there was no...

Accessing the clipboard in JavaScript

Accessing the clipboard in JavaScript

  • September 8, 2021

Developers are probably the laziest people on the planet. And of all the things, copy-paste is our favorite keyboard shortcut. But what is better than hitting ctrl + c? Having a button do the copying for you! And that is now possible using an asynchronous version of the clipboard API...