Javascript Articles - Page 210 of 534

Mapping an array to a new array with default values in JavaScript

Nikitasha Shrivastava
Updated on 23-Aug-2023 17:46:32

980 Views

In the given problem statement we are required to map an array to a new array with default values with the help of javascript functionalities. In Javascript we have some built−in function to map an array to a new array as per the condition and requirement. What is an array in Javascript ? An array is a collection of similar data elements under one roof. So let's understand the overall working process of arrays in JavaScript. An array is an object that contains one or more elements. Example const arr = ['A', 'B', 'C', 'D']; console.log(arr); Output [ ... Read More

Manipulating objects in array of objects in JavaScript

Nikitasha Shrivastava
Updated on 23-Aug-2023 17:41:43

4K+ Views

In the given problem statement we are asked to manipulate objects in an array of objects with the help of javascript functionalities. In Javascript we have some built−in functions called map(), reduce(), forEach() and filter() to manipulate the objects in an array. We can solve this problem with the help of these functions. What is the manipulating object in an array ? Let's understand the manipulation of objects in an array. Manipulation means updating an array object, deleting an array object or adding an object in an array. In Javascript, there are several methods present to do these kinds of ... Read More

How to implement backtracking for a climbing stairs practice in JavaScript?

Nikitasha Shrivastava
Updated on 23-Aug-2023 13:01:08

412 Views

In the given problem statement we are asked to implement backtracking for a climbing stairs practice with the help of javascript functionalities. In the data structures backtracking is popularly known to explore all the possible solutions. We can solve this problem with the help of a backtracking algorithm. What is the Backtracking Technique ? Let's understand the working of a Backtracking technique. Backtracking is a well known algorithm technique, which is basically used to solve the problem statements that include searching for all possible solutions. It is based on a depth−first strategy and it is used in combination with a ... Read More

Fibonacci like sequence in JavaScript

Nikitasha Shrivastava
Updated on 23-Aug-2023 12:37:52

449 Views

In the given problem statement we are asked to create a fibonacci like sequence with the help of javascript functionalities. In the Javascript we can solve this problem with the help of recursion or using a for loop. What is the Fibonacci Sequence ? Let's understand the working of a Fibonacci sequence in JavaScript. As we know that Fibonacci sequence is a sequence of numbers in which every number is the sum of the two forgoing numbers. The series starts from 0 and 1. The next number in the series is 1 (0 + 1), followed by 2 (1 ... Read More

Calculate the difference between the first and second element of each subarray separately and return the sum of their differences in JavaScript

Nikitasha Shrivastava
Updated on 22-Aug-2023 14:13:17

376 Views

In the given problem statement we are asked to calculate the difference between the first and second element of each subarray separately and we have to return the sum of their differences with the help of javascript functionalities. In the array data structures we can define an array which can also contain subarrays. What is an Array of Subarrays in JavaScript ? Let's understand the working of a list in JavaScript. In javascript we can define array of subarray or nested array. An array of subarrays is an array which contains one or more arrays as its elements. Every array ... Read More

Calculating the average for each subarray separately and then return the sum of all the averages in JavaScript

Nikitasha Shrivastava
Updated on 22-Aug-2023 14:16:44

255 Views

In the given problem statement we are asked to calculate the average for each subarray separately and then return the sum of all the averages with the help of javascript functionalities. As we talk about average for subarrays we can use the reduce method of javascript. What is the reduce() Method in JavaScript ? Let's understand the working of a reduce function in JavaScript. In javascript the reduce method is used to reduce an array to a single value by iterating over each and every item of the array. And by applying the callback function that accumulates a value based ... Read More

Sorting an array including the elements present in the subarrays in JavaScript

Nikitasha Shrivastava
Updated on 23-Aug-2023 13:08:25

278 Views

In the given problem statement we are asked to sort an array including the elements present in the subarrays with the help of javascript functionalities. As we talk about sorting any list or array the sort() and flat method is useful. What are sort(), flat() and isArray() methods in JavaScript ? Let's understand the working of sort, flat and isArray methods in JavaScript. The sort() method is basically used to sort the elements of an array and returns the sorted array. The items are sorted in dictionary order by default. But we can provide a function as an argument to ... Read More

JSON group object in JavaScript

Nikitasha Shrivastava
Updated on 23-Aug-2023 14:34:43

855 Views

In the given problem statement we are asked to group the JSON object with the help of javascript functionalities. This problem can be solved with the help of a simple algorithm in javascript. What is JSON ? JSON (Javascript Object Notation) is lightweight data which can be transferred between two devices. This data can be read and written by humans. JSON objects are represented in the form of key−value pairs. Keys are strings to define values. In JSON each entry is separated by a semicolon. For example − {“Car” : “Audi”}, in this example Car is a key and Audi ... Read More

Maximum decreasing adjacent elements in JavaScript

Nikitasha Shrivastava
Updated on 23-Aug-2023 17:49:31

243 Views

In the given problem statement we are asked to find out maximum decreasing adjacent elements with the help of javascript functionalities. This problem can be solved with the help of a simple algorithm in javascript. Understanding the Logic Explaining the logic of the problem statement in more detail. The problem asks us to get the maximum number of decreasing adjacent items in an array or we can say we have to find the longest decreasing subarray in the input array. So for solving this problem we need to work by iterating all over the array, one item at a time ... Read More

Using BigInt to calculate long factorials in JavaScript

Nikitasha Shrivastava
Updated on 23-Aug-2023 13:57:07

1K+ Views

In the given problem statement we are asked to find out long factorials of a Bigint value with the help of javascript functionalities. BigInt is a data type in javascript, which is used to calculate the factorial of a large number. What is the BigInt data type in JavaScript ? Let's understand the working of a BigInt data type in JavaScript. In Javascript, there are so many data types available to define the data, one of them is BigInt. BigInt is a built−in data type in Javascript which represents integers of large size. It was introduced in ECMAScript 2020. It ... Read More

Advertisements