
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 6710 Articles for Javascript

399 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

970 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

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

5K+ 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

8K+ 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

275 Views
In the given problem statement our task is to get the partial sum in an array of arrays with the help of Javascript functionalities. So we will calculate the sum of rows and give the result. Understanding the Problem The problem at hand is to compute the partial sum of an array of arrays. So first understand what an array of arrays is! Array of arrays means each item represents an array itself. For example see the below array of arrays: [ [11, 12, 13], [14, 15, 16], [17, 18, 19] ] The partial sum at ... Read More

634 Views
Our main task is to write the function to destructively sum all the digits of a number with the help of Javascript. So for doing this task we will use a while loop and a function to get the desired output. Understanding the problem statement The problem is to create a function to calculate the sum of all the digits in the given number. Means we have given a number and we have to calculate the sum of all the digits in a destructive manner as the original number is modified during the process. For example let's say we have ... Read More

229 Views
We are required to write a JavaScript function that takes in two dates in the 'YYYY-MM-DD' format as the first and second argument respectively. The function should then calculate and return the number of days between the two dates.For example −If the input dates are −const str1 = '2020-05-21'; const str2 = '2020-05-25';Then the output should be −const output = 4;Exampleconst str2 = '2020-05-25'; const daysBetweenDates = (str1, str2) => { const leapYears = (year, month) => { if (month (year * 365) + leapYears(year, month) + monthDays[month] + d; let p = days(...str1.split('-').map(Number)); ... Read More

723 Views
In the given problem statement we have to write a method for mapping values to keys with the help of Javascript. So for doing this task we will use an object literal in Javascript. Understanding the problem statement So we have to find out the value for the given key and for doing this task we can use an object literal. An object is a data structure which can store the data in key-value pairs. So the keys are the identifier of the values. With the help of keys we can access the values. In Javascript there are several methods ... Read More

228 Views
In the given problem statement, our task is to return the element that appears for the second most number of times in the array with the help of Javascript. So to solve this problem we will use map function to count the frequency of every element. Understanding the problem statement The given problem is to get the element in the given array which appears for the second most number of times. Suppose we have an array of integer numbers [1, 3, 3, 4, 4, 4] so the function should return 3 as we can see in the array 3 is ... Read More