Web Development Articles

Page 140 of 801

Get key from value in JavaScript

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

Get all substrings of a string in JavaScript recursively

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

Function to reverse a string JavaScript

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

Function to find out palindrome strings JavaScript

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

In this problem statement, our aim is to create a function to find out that the given string is palindrome with the help of Javascript functionalities. So for solving this problem first we need to understand the problem in simple terms. Understanding the problem statement We have given a string as an input string and our main aim is to check if the string is a palindrome string or not. If it is palindrome then return true otherwise return false. What do you mean by palindrome? In the given problem statement there is the usage of the word palindrome !! ...

Read More

Finding longest substring between two same characters JavaScript

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

Find number of spaces in a string using JavaScript

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

In this problem statement, our task is to find the number of spaces in a string with the help of Javascript functionalities. This task can be done with the help of the split method of Javascript. This method can be useful to split the string into an array of substrings as per the spaces. Logic for the given problem The problem stated that we have to find the number of spaces in a given string and we will use the split method. So at the very first step we will split the string and create an array of substrings as ...

Read More

Fetch Numbers with Even Number of Digits JavaScript

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

In the given problem statement our task is to write the function for fetching the numbers with an even number of digits with the help of Javascript. For solving this task we will use a for loop and push every even number in the array. Understanding the problem statement The problem statement is to write a function which will take an array of numbers as input and return the array for containing only numbers that have an even number of digits. For example if we have an input array is [1 ,2 , 3, 4, 5] the function should return ...

Read More

Dynamic Programming - Part sum of elements JavaScript

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

Destructively Sum all the digits of a number in JavaScript

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

Checking if a number is some power of the other JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 18-May-2023 441 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
Showing 1391–1400 of 8,006 articles
« Prev 1 138 139 140 141 142 801 Next »
Advertisements