Found 6683 Articles for Javascript

Capitalizing first letter of each word JavaScript

Nikitasha Shrivastava
Updated on 18-May-2023 11:50:59

355 Views

In this problem statement, our task is to capitalize the first letters of each word with the help of Javascript functionalities. To solve this problem we need to understand the meaning and logic of the problem. Understanding the problem statement The problem statement is to write a function in Javascript that will help to capitalize the first letter of every word in the given string. For example, if we have a string "hello world", the converted version of this string is "Hello World". Logic for the given problem For the code we will create a function to do the given ... Read More

Reversing the words within keeping their order the same JavaScript

Nikitasha Shrivastava
Updated on 18-May-2023 15:51:03

775 Views

In this problem statement, our aim is to reverse the words within keeping their order in the same order with the help of Javascript functionalities. So for solving this problem we can use traditional for loops and also built-in methods or Javascript. Understanding the problem statement The problem statement is aiming for a function which takes a string as input and will return a new string in which the order of the words should remain intact but in reversed direction. For example, we have given a string "Hello World" so the function should return "olleH dlroW", here "Hello" is reversed ... Read More

Checking for string anagrams JavaScript

Nikitasha Shrivastava
Updated on 18-May-2023 11:55:13

191 Views

In this problem statement, our aim is to check for string anagrams 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 an anagram string or not. If it is anagram then return true otherwise return false. What do you mean by anagrams? In the given problem statement there is the usage of the word anagram!! Let’s first understand the meaning of this word. Anagram ... Read More

Function to find out palindrome strings JavaScript

Nikitasha Shrivastava
Updated on 18-May-2023 13:39:42

121 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

Implementing counting sort in JavaScript

Nikitasha Shrivastava
Updated on 18-May-2023 14:35:46

1K+ Views

In the given task, our aim is to create a counting sorting technique and implement this problem with the help of Javascript functionalities. What is the Counting Sort? The counting sort is a process for sorting a data set of objects as per the keys. It works by counting the number of items that have different key values and finding the position of each object in the sorted output. The idea of counting sort is to place the items directly into its correct place in the output array. In the beginning of the algorithm we need to find ... Read More

Function to reverse a string JavaScript

Nikitasha Shrivastava
Updated on 18-May-2023 13:51:03

405 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

Finding the nth missing number from an array JavaScript

Nikitasha Shrivastava
Updated on 18-May-2023 12:32:21

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

Sorting numbers according to the digit root JavaScript

Nikitasha Shrivastava
Updated on 18-May-2023 15:54:54

166 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

JavaScript Count repeating letter

Nikitasha Shrivastava
Updated on 18-May-2023 14:39:38

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

N consecutive odd numbers JavaScript

Nikitasha Shrivastava
Updated on 18-May-2023 15:05:33

520 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

Advertisements