- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6683 Articles for Javascript
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
355 Views
In the given problem statement we have to group a sorted array based on the difference between the current and previous elements with the help of Javascript functionalities. To group a sorted array based on the difference between the current and previous items we can iterate over the array and create a new array of groups. Understanding the Problem Statement The above problem statement states that we have to find out the group of elements based on the difference between the current and previous elements in the array. As we have given a sorted array so we need ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
405 Views
In this problem we have to create an algorithm to get the highest and lowest value difference of an array with the help of Javascript functionality. So we will solve the problem with for loop and initialization of highest and lowest values to Infinity. Understanding the logic of the problem statement The problem statement is asking to write the code for getting the highest and lowest value difference of the array. So for solving this task we will initialize two variables, these variables will store the highest and lowest values. And then iterate through every element ... Read More
JavaScript Sum odd indexed and even indexed elements separately and return their absolute difference
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
1K+ Views
In this problem we will understand how to get the absolute difference of the sum of odd indexed and even indexed items separately with the help of Javascript functionalities. We will use a simple loop to iterate through all the elements of the array. Understanding the problem statement To understand the above problem statement we will break down the problem step by step: So we are given an array of numbers. Our task is to separate the items in the array in two groups: first ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
727 Views
In the given problem statement, our aim is to get the average of all the items with the help of the reduce method of Javascript. So for doing this task we will create a function and give an array as a parameter. Understanding the problem statement We have given a task to calculate the average value of the given items in the array. And we have to use the reduce method which is a predefined method of Javascript. For example if we have an array as [1, 2, 3, 4, 5], so the average value of the ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
325 Views
In this problem statement our aim is to write an algorithm to remove duplicate items from an array with a function with the help of Javascript functionalities. Understanding the problem statement In the above problem statement we have to create a function by which we can accept an array as a parameter and give a new array to store the unique items from the given input array and without including the identical values. For example - suppose we have an array as [0, 0, 2, 2, 3, 3] so after removing the duplicate numbers we will have ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
243 Views
In this article we will discuss algorithm and complexity for converting string with separator to array of objects with the help of Javascript functionalities. For doing this task we will use split and map functions of Javascript. Understanding the problem statement The problem statement says to write a function which can convert a given string with the given separator into an array of objects in Javascript. For example, if we have a string "name1, name2, name3" and a separator ", " then we have to convert these strings into an array of objects which looks like: [{value: ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
677 Views
In the provided problem statement, our task is to write the function for partial sum in an array of arrays with the help of Javascript. So here we will be given a variety of arrays and we need to compute the sum of each row and show the result. Understanding the problem statement The problem statement is asking for creating a function in Javascript which rounds down a given input number to the nearest power of 10. For example if there is an input 1365 so the output should be 1000. That is the nearest power of 10 which is ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
2K+ Views
In the provided problem statement, our aim is to get all substrings of a string recursively with the help of Javascript. So here we will be creating a recursive function that can generate all possible substrings of a given input string. Understanding the problem statement The problem statement is asking us to create a recursive function which can generate all the possible substrings of a given input string with the help of Javascript. A substring is any continuous sequence of characters within the input string. For example: input strings “xy" so the possible substrings are "x", "y", and "xy". Algorithm ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
4K+ Views
The above problem statement is about masking a substring within a string with the help of asterisks in Javascript. So we have to create a function to get the string with some hidden characters. Understanding the problem statement In the above problem statement we have to mask a substring within a string with the help of asterisks in Javascript. Masking a given string means we have to replace the certain characters in the given string with some other characters. Normally the asterisks used to hide sensitive information such as passwords, credit card numbers and other confidential data. Logic for the ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
6K+ Views
In the given problem we are required to retrieve the key and values from an object in an array with the help of Javascript. So here we will retrieve the keys and values from an object in an array with the help of two methods provided by the object class in Javascript. Understanding the Problem Statement The problem statement is to retrieve the keys and values from a given object in an array with the help of Javascript. So in Javascript the object is a collection of properties in which every property is a key and value pair. ... Read More