AmitDiwan has Published 11365 Articles

JavaScript Program to Find a triplet such that sum of two equals to third element

AmitDiwan

AmitDiwan

Updated on 13-Mar-2023 16:47:59

185 Views

We will be writing a JavaScript program that finds a triplet where the sum of two elements equals the third element. This program will be implemented using arrays and loop structures. We will be iterating through the array and checking for each element if the sum of two elements equal ... Read More

JavaScript Program to Efficiently compute sums of diagonals of a matrix

AmitDiwan

AmitDiwan

Updated on 13-Mar-2023 16:44:30

231 Views

We are going to write a program in JavaScript that efficiently computes the sum of the diagonals of a matrix. To do this, we will utilize a loop structure that iterates through the matrix and adds the elements located at the positions that correspond to the diagonals. By taking advantage ... Read More

JavaScript Program To Delete Nodes Which Have A Greater Value On Right Side

AmitDiwan

AmitDiwan

Updated on 13-Mar-2023 16:42:33

205 Views

We will be implementing a function to delete nodes in a linked list which have a greater value on their right side. The approach is to traverse the linked list from right to left and keep track of the maximum value encountered so far. For each node, we will compare ... Read More

JavaScript Program To Delete Alternate Nodes Of A Linked List

AmitDiwan

AmitDiwan

Updated on 13-Mar-2023 16:34:29

155 Views

We will be writing a JavaScript program to delete alternate nodes of a linked list. We will be utilizing a while loop to traverse the linked list while keeping a track of the current and previous node. In each iteration of the loop, we will be skipping the current node ... Read More

JavaScript Program to Count triplets with sum smaller than a given value

AmitDiwan

AmitDiwan

Updated on 13-Mar-2023 16:30:56

249 Views

We will be writing a JavaScript program to count the number of triplets with a sum smaller than a given value. This problem can be solved by sorting the array and using two pointers to check for the possible combinations. Firstly, we will sort the array in ascending order and ... Read More

JavaScript Program to Count rotations which are divisible by 10

AmitDiwan

AmitDiwan

Updated on 13-Mar-2023 16:28:44

156 Views

We are going to write a program in JavaScript that counts the number of rotations of a given number which are divisible by 10. We will loop through the rotations of the number and check if each one is divisible by 10. If a rotation is divisible, we will increment ... Read More

JavaScript Program to Count rotations required to sort given array in non-increasing order

AmitDiwan

AmitDiwan

Updated on 13-Mar-2023 16:24:04

95 Views

We will be writing a program to count the number of rotations required to sort an array in non-increasing order. The program will use a loop to traverse the array and keep track of the maximum element found so far. When a smaller element is found, we will increment the ... Read More

How to calculate minutes between two dates in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:31:26

10K+ Views

In this article, you will understand how to calculate minutes between two dates in JavaScript. The Date object works with dates and times. Date objects are created with new Date(). JavaScript will use the browser's time zone and display a date as a full text string. Example 1 In this ... Read More

How to add an element to a JSON object using JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:29:18

26K+ Views

In this article, you will understand how to add an element to a JSON object using JavaScript. JSON object literals are keys and values are separated by a colon surrounded by curly braces {}. Example 1 In this example, we add an element to a json object using bracket notation, ... Read More

How to access object properties from result returned by async() function in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Feb-2023 15:24:54

730 Views

In this article, you will understand how to access object properties from result returned by async() functions in JavaScript. An object property in JavaScript is a variable that is associated with the object itself, i.e. the properties have a name and value is one of the attributes linked with the ... Read More

Advertisements