- 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)
449 Views
In this problem statement, our aim is to write the function for reversing the array without changing the position of certain elements with the help of Javascript. So for doing this task we will be keeping track of the indexes of the preserved elements. . Understanding the problem statement The problem is for creating a function to reverse an array in Javascript but with certain elements in the array must not be changed their position. So the positions of these items should be the same in both the original and reversed arrays. For example let's say we have an array ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
109 Views
In this problem statement, our task is to write a function to remove numbers from the array and shift the remaining elements with the help of Javascript functionalities. So we will use basic for loop to remove one element from the array and shift the remaining elements to get the output array. Understanding the problem statement The problem statement is saying to create a function which can remove a given number from an array and shift the remaining items to fill the gap of the removed item. For example we have given an array [1, 2, 3, 4, 5] and ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
544 Views
Given a m * n matrix of distinct numbers, we have to return all lucky numbers in the 2-D array (matrix) in any order.A lucky number is an element of the matrix such that it is the minimum element in its row and maximum in its column.For example − If the input array is −const arr = [ [3, 7, 8], [9, 11, 13], [15, 16, 17] ];Then the output should be −const output = [15];because 15 is the only lucky number since it is the minimum in its row and the maximum in its column.ExampleThe code ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
146 Views
In this problem statement, our task is to write a function for queue reconstruction by height with the help of Javascript. So basically we have to arrange the given array data by height. Understanding the problem statement The problem statement says to write a function in Javascript with the help of we can arrange the queue as per the height. This will be done by queue reconstruction. The Queue Reconstruction by height problem is done by arranging a queue of persons based on their height and the number of people in front of them who are taller or have ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
2K+ Views
In the given problem statement we have to write a function which will help to get the key of the given value with the usage of Javascript functionalities. So basically in Javascript if we want to access the keys or value from the given object we can access it by dot notation or bracket notation. Understanding the problem statement The problem statement says that we have to find a key from a value in a Javascript object. That means we are given a Javascript object and a value so we need to find the corresponding key which maps to that ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
804 Views
In this problem statement, our aim is to write the factorial function with reduce and range with the help of Javascript. So basically range and reduce are the predefined functions of Javascript. What is the use of reduce and range functions in Javascript ? In Javascript the reduce and range functions are the most useful function when working with arrays. The reduce function takes an array and reduces it to a single value by processing a function for every item of the array. The function takes two parameters, the first one is the accumulator which stores the result of ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
2K+ Views
In this problem statement, our task is to to create a nested unordered list based on nesting of arrays with the help of Javascript. So for doing this task we will use a function to call recursively for each nested array and create a new unordered list.. Understanding the problem statement In the above problem statement we have to create a function for a nested list in HTML using Javascript. The input for the code will be an array that can have any number of items and can also include other arrays that represent nested lists. The code will be ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
326 Views
In the given problem statement, we have to print an inverted count with a recursive loop and code with the help of Javascript. So basically we have to print the count in inverted count or we can say in descending order. What is Recursive technique ? The recursive technique is an approach that involves solving a problem by breaking it into smaller pieces of the same problem till a base case is reached. This function calls itself with different arguments in order to achieve the required output. This is commonly used when the solution to a problem depends on ... Read More
![Nikitasha Shrivastava](https://www.tutorialspoint.com/assets/profiles/655298/profile/60_3988199-1684213136.jpeg)
1K+ Views
In this problem statement, our aim is to sort strings with decimal points with the help of Javascript functionalities. So for doing this task we will use the sort and map method of Javascript. Understanding the problem statement The problem statement is to write a function in Javascript by which we can sort the given strings with decimal points. For example if we have an array of strings like [‘3.3’, ‘4.4’, ‘2.3’, ‘1.2’] so our task is to sort the given array of strings. But for sorting these strings first we need to convert it into numbers. After converting ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
251 Views
Suppose, we have a sorted (increasing order) array of Numbers like this −const arr = [2, 5, 7, 8, 9];We are required to write a JavaScript function that takes in one such array. The function should construct a new subarray for each element of the input array.The sub-array should contain the difference (difference between that very element and the succeeding elements one by one) elements.Therefore, for the first array element, the differences are −5 - 2 = 3 7 - 2 = 5 8 - 2 = 6 9 - 2 = 7Therefore, the subarray for the first element should ... Read More