
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

562 Views
In this problem statement, our target is to print the n consecutive odd numbers and implement this problem with the help of Javascript functionalities. So we can solve this problem with the help of loops in Javascript. Understanding the problem statement The given problem is stating that we have given a string to which we have to reverse the string. In simple terms we can say that if we have the string “Hello”, the reverse of this string will be “olleH”. Logic for the given problem For solving the above problem we need to have the basic knowledge of ... Read More

2K+ Views
In the problem mentioned our aim is to find the nth missing number in the given array and implement its solution in Javascript. To solve this question we will use a for loop and some basic functions of Javascript. Logic for the given problem Our task is to find the nth number which is missing in the array. For solving this problem we will define two variables to know the position of the missing number and previous element. So traverse through the input array and check for the missing items between the current and previous items. If the missing ... Read More

224 Views
In this problem statement, our task is to sort numbers according to the digit root and implement this problem with the help of Javascript functionalities. So we can solve this problem with the help of loops in Javascript. What is digit root? The digit root of a given number is basically the sum of its digits. Repeat the calculation until the result is not a single digit. Let's take an example for the digit root, calculate the digit root for 1234, 1 + 2 + 3 + 4 = 10 = 1 + 0 = 1. Similarly the digit root ... Read More

3K+ Views
In this problem statement, our target is to count the repeating letter in the given string with the help of Javascript functionalities. So we can solve this problem with the help of loops and some built-in methods of Javascript. Logic for the given problem In the given problem statement we have to design a program to count the repeating letters in the given string. For implementing this task first we will create a blank object for count, array for repeated characters and another object for results. Then we will loop through every character in the string. So for every ... Read More

702 Views
In this problem statement, our target is to print the n consecutive odd numbers and implement this problem with the help of Javascript functionalities. So we can solve this problem with the help of loops in Javascript. Logic for the given problem In the given problem statement we have to design a program to generate a given number of consecutive odd numbers starting from 1. It will be done by creating an empty array to store the odd numbers and then using a loop which will run n times to add every odd number to the created array. The loop ... Read More

385 Views
In this problem statement, our objective is to check if a given input number is some power of the other number. And implement this problem with the help of Javascript functionalities. Logic for the given problem The main objective of this problem statement is to determine if a given number is a power of another number. We need to use Javascript to implement this code. To check if a number a is a power of another number b, we can take the logarithm of a with base b using the math.log function and then we can check if the ... Read More

2K+ Views
Our work in this problem statement is to find the pair of adjacent elements that has the largest product and return the product if we have given an array. And we have to implement this problem with the help of Javascript functionalities. Logic for the given problem In the given problem statement we have to calculate the product of the largest elements in the array and show the resultant output to the console. So we will implement this problem with two methods: first is by using the infinity and second without using infinity. Infinity is a global object. The ... Read More

466 Views
In this problem statement, our task is to calculate the sum of all the elements of the array and remove one element at every step and show the resultant array of sum of all the possible subarrays. And implement this problem with the help of Javascript functionalities. Logic for the given problem The given problem states that we have to calculate the sum of every element except one element at every step. To solve the given problem we will define an array as input and return the output as an array of sums of elements by deducting one element ... Read More

1K+ Views
In this problem statement, we are required to find all the possible numbers in an array that can sum to a given target value with the help of Javascript functionalities. This task can be done with the help of some built in functions of Javascript or we can solve it by multiple for loops. Logic for the given problem The problem stated that we have to get the possible numbers in an array which can give the exact value as target value by summing them up with the help of Javascript functionalities. As we have to find out the numbers ... Read More

1K+ Views
We are required to write a JavaScript function that takes in a string containing spaces. The function should simply count the number of spaces present in that string.For example −If the input string is −const str = 'this is a string';Then the output should be −const output = 4;Exampleconst str = 'this is a string'; const countSpaces = (str = '') => { let count = 0; for(let i = 0; i < str.length; i++){ const el = str[i]; if(el !== ' '){ continue; }; count++; }; return count; }; console.log(countSpaces(str));OutputThis will produce the following output −4