Javascript Articles

Page 152 of 534

Random whole number between two integers JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 271 Views

In the given problem statement, we have to find the whole number between two integers with the help of Javascript functionalities. So for doing this task we can use some in-built functions of javascript and also for loop to get the required result. Understanding the problem statement The problem statement is to write a function in Javascript that will help to find out the whole random number between two integer numbers. For example if we want to print a random number between 1 to 5 so there are 5 possibilities, the number can be 1, 2, 3, 4, 5. So ...

Read More

Queue Reconstruction by Height in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 265 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

Numbers smaller than the current number JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 616 Views

In the given problem statement we have to find the smaller numbers than the current number with the help of Javascript. So for doing this task we will be keeping track of the items and decrement the current number by one to get the desired result. Understanding the problem statement The problem statement is asked to write a function which will take an array of integers as input and will return the array of the same length in which every element shows the count of the numbers in the given array which are smaller than the respective item. For example ...

Read More

Nth element of the Fibonacci series JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 1K+ Views

In this problem statement, our aim is to find the nth element in the fibonacci series with the help of Javascript functionalities. To solve this problem we will use a recursive technique. Understanding the problem statement The problem is to write a function in Javascript that will help find the nth number in the fibonacci sequence. For example, if we want to know the 3rd number in the fibonacci series then the 3rd number is 2. What is the Fibonacci series? The Fibonacci sequence is the chain of numbers in which each number is the sum of previous numbers. The ...

Read More

N consecutive odd numbers JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 763 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

Maximum difference between a number JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 394 Views

In this problem statement, our task is to write the function for finding the maximum difference between a number in an array with the usage of Javascript functionalities. So we will use a nested loop to get the difference between two numbers. Understanding the problem statement The above problem statement is saying to find the maximum difference between any two numbers in the given array of integer numbers. In simple terms we have to find the largest possible difference between any two numbers of the array in which the larger number appears after the smaller number. Suppose we have an ...

Read More

Masking a string JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 6K+ 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

Mapping values to keys JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 805 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

Finding Lucky Numbers in a Matrix in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 929 Views

In the given problem statement we have to write a function to get the lucky numbers in a matrix with the help of Javascript. So we will implement this task with for loops and functions of Javascript. Understanding the problem statement The problem statement is asking us to find the lucky numbers in a given matrix. So the lucky number will be defined as a number in the matrix which is the minimum value for its own row and the maximum value for its column. For example we have a matrix [ [3, 7], [9, 11] ], in this ...

Read More

JavaScript Count repeating letter

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 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
Showing 1511–1520 of 5,338 articles
« Prev 1 150 151 152 153 154 534 Next »
Advertisements