Category: JavaScript Certification

Understand CSS functional pseudo-class selectors :is() and :where()

Long selector lists can occasionally result from developing CSS in order to target numerous items with the same style rules. A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s). Both :is() and :where() are pseudo-class functions that will help shorten and avoid repetition in creating the selectors. They both take an array of arguments of selectors (ids, classes, tags, etc..) and selects any element that can be selected in that list. Read this blog post or watch the video below to learn more about the :is() and :where(). Problem Statement When we...

Read More

Fill an Array with Initial Values in JavaScript

Arrays can be initialised with data in a variety of ways in JavaScript. Let’s examine which methods are the easiest and most popular in this post.   Read this blog post or watch the video below to learn more about different ways to fill an array with initial values in JavaScript. #1 Fill an array with primitives Let’s say, you want to initialize an array of elements 5 with the number 1. You can use the array.fill(initialValue) method to initialize an array. This method will return the modified array. The thing that you need to keep in mind is the...

Read More

Sparse vs Dense Arrays in JavaScript

Arrays in JavaScript is a very important concept. Developers are dealing with Arrays like creating, manipulating etc almost every day while implementing logics. Arrays are very easy to understand in JavaScript. An array is a special variable, which can hold more than one value But do you know that Arrays can hold nothing i.e. it is possible to create hole in an Array? In this post, I will be discussing about Sparse and Dense Arrays. Also I will be talking about how to create them and what you can do with this type of arrays. I have written a...

Read More

Group Arrays in JavaScript using Array.GroupBy

JavaScript continuously enriches its standard library on strings and arrays. In today’s post, I will be discussing the new array group proposal which is currently at stage 3. This new proposal introduces new methods array.groupBy() and array.groupByToMap(). You can get their polyfills from the core-js library. Let’s see examples below to understand how these methods work.   Read this blog post or watch the video below to learn more about the JavaScript array.groupBy() and array.groupByToMap() method. array.groupBy() Let’s say you have the below list of countries, where each country is an object with 2 properties name and continent. const countries =...

Read More

JavaScript Void Operator

When an expression is evaluated using the void operator, the result is undefined. This operator is typically used to obtain an undefined primitive value. It’s frequently used in conjunction with hyperlinks. When you click a link, your browser usually refreshes the page or loads a new one. When we don’t want the browser to refresh or load a new page when we click a hyperlink, we can use javascript:void(0). The operand 0 can be used in two ways: void(0) or void 0. Both methods are equally effective. JavaScript:void(0) instructs the browser to “do nothing,” preventing the page from being...

Read More
Loading