Shubham Vora has Published 957 Articles

JavaScript Program to Count Rotations Divisible by 4

Shubham Vora

Shubham Vora

Updated on 20-Apr-2023 17:02:19

209 Views

In this tutorial, we will learn to count the total number of rotations divisible by 4 for the given number. Problem statement − We have given a number value. We need to rotate numbers in clockwise or anti-clockwise directions and count the total number of rotations divisible by 4. Here, ... Read More

JavaScript Program to Count Inversions of size three in a given array

Shubham Vora

Shubham Vora

Updated on 20-Apr-2023 17:00:45

188 Views

In this tutorial, we will learn to count inversions of size three in a given array. Problem statement − We have given an array of length n containing the different numeric entries. We need to find the total number of pairs of numbers of size 3 such that arr[i] > ... Read More

How to conditionally add a member to an object using JavaScript?

Shubham Vora

Shubham Vora

Updated on 20-Apr-2023 16:32:29

3K+ Views

The object is the most important data type of JavaScript. Even everything is an object in JavaScript. For example, Array is an object, and Number, String, and Boolean can also be an object. Sometimes, developers require to insert properties into the object based on some condition. For example, we have ... Read More

How to create an id using mongoose in Javascript?

Shubham Vora

Shubham Vora

Updated on 19-Apr-2023 15:27:55

4K+ Views

In this tutorial, we will learn to create an id using mongoose in JavaScript. Users can use the Mongoose NPM package in NodeJS to use MongoDB with NodeJS or connect MongoDB with the application. While storing the data in the MongoDB database, we must add a unique id to every ... Read More

How to compute union of JavaScript arrays?

Shubham Vora

Shubham Vora

Updated on 19-Apr-2023 15:27:10

593 Views

We can get the union of two arrays by merging both arrays and removing duplicate elements, and the union gives unique elements from both arrays. In this tutorial, we will learn to compute the union of JavaScript arrays using various approaches. Use the set() Data Structure The first approach is ... Read More

Finding the time elapsed in JavaScript

Shubham Vora

Shubham Vora

Updated on 19-Apr-2023 15:26:21

22K+ Views

Sometimes, it requires finding the total time elapsed while performing some operations in JavaScript. For example, we require to find the total time elapsed from users who have updated their profiles. Also, there can be other similar use cases where we need to find the difference between the particular time ... Read More

Find the OR and AND of Array elements using JavaScript

Shubham Vora

Shubham Vora

Updated on 19-Apr-2023 15:25:18

130 Views

In JavaScript, we can use the ‘&&’ operator to perform the AND operation between two elements and the ‘||’ operator to perform OR operation between two elements. Here, we will learn to perform OR and AND operations between every element of the array. Use the for Loop We can use ... Read More

How to concatenate regex literals in JavaScript?

Shubham Vora

Shubham Vora

Updated on 19-Apr-2023 15:24:09

2K+ Views

The regex literals are regular expressions, a sequence of characters to match the strings. Sometimes, developers require to combine regular expressions. However, a regular expression is also one type of string, but we can’t concat them like a string using the ‘+’ operator. So, we first require to get flags ... Read More

Which table property specifies the width that should appear between table cells in CSS?

Shubham Vora

Shubham Vora

Updated on 19-Apr-2023 14:27:27

512 Views

In HTML, a table contains columns and rows. The table cells don’t contain the space between two cells by default. If we add some space between table cells, it can improve the UI of the table. In CSS, the ‘border-spacing’ property adds the space between the table space. Also, we ... Read More

Which property specifies the width of a border in CSS?

Shubham Vora

Shubham Vora

Updated on 19-Apr-2023 14:25:57

296 Views

In CSS, the ‘border’ property is used to apply the border to any HTML element, such as div. Also, we can set the different styles for the border, color, width, etc. In this tutorial, we will learn different approaches to set the width of the border of the element. ... Read More

Advertisements