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
Javascript Articles - Page 199 of 534
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
760 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
440 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
514 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
519 Views
In this problem statement, our task is to find all the possible odd length subarrays 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 all the possible odd length of the subarrays in Javascript programming language. The meaning of add length is that the length of the subarrays should be 1, 3, 5, 7, .....end so on. So our task is to filter the length ... Read More
555 Views
In this problem statement, our task is to show working of some special arrays and their characteristics in Javascript programming. In Javascript a special array can be dependent on the given context. The special arrays can refer to different types of arrays depending on the condition and context. There are some interpretations possible: Typed arrays, Sparse arrays and Array with string keys. What is the Typed Array? In Javascript there are many built-in methods available for typed array objects. These arrays are special in the context that they represent the array of a specific type of data in it. ... Read More
562 Views
In this problem statement, our task is to find the longest substring between two same characters with the help of Javascript functionalities. This task can be done with the help of map function to keep track of the two same characters. Logic for the given problem The problem stated that we have to find the longest substring between two same characters in the given string. For example if we have a string like 'abcdefa', there are two same characters 'a' that have 5 characters called 'bcdef', so this will be called longest substring. For implementing the above given problem, ... Read More
1K+ Views
We are required to write a JavaScript function that takes in an array of numbers that might contain some repeating numbers.The function should sort the array such that the elements that are repeated for the least number of times appears first followed by the elements with increasing frequency.For example −If the input array is −const arr = [1, 1, 2, 2, 2, 3];Then the sorted array should be −const output = [3, 1, 1, 2, 2, 2];Exampleconst arr = [1, 1, 2, 2, 2, 3]; const frequencySort = (arr = []) => { let map = {}; for ... Read More
220 Views
We are given an array of distinct integers, let’s say arr, and another array of integer arrays, let say sourceArr.In the sourceArr array, the integers are distinct. We should write a function that forms arr by concatenating the arrays in sourceArr in any order.However, we cannot reorder the integers inside of any subarray in the soureArr. We should return true if it is possible to form the array arr from sourceArr, false otherwise.For example −const arr = [23, 67, 789]; const sourceArr = [[23], [789, 67]];The function should return false because we cannot reorder the elements inside a subarray and ... Read More