Skip to content

chandhru2008/JavaScriptProblems

Repository files navigation

JavaScript Problems:

Basic & Arithmetic: -

1.Write a JavaScript program to display the current day and time in any format.

2.Write a JavaScript program to get current date.

3.Write a JavaScript program to return the sum of two numbers.

4.Write a JavaScript program to find the aria of triangle.

5.Write a JavaScript program to calculate multiplication and division of two numbers.

6.Write a JavaScript program to find the browser window size.

7.Write a JavaScript program to find the entered year is leap year or not.

8.Write a JavaScript program to check two given numbers, whether one is positive and another one is negative.

9.Write a JavaScript program to find the odd and even numbers between 1-100.

10.Write a JavaScript program to find the given number is power of 2.

Functions: -

1.Write a JavaScript functions to reverse the given number.

2.Write a JavaScript functions to check the give string is palindrome or not.

3.Write a JavaScript functions that generates all combination of strings.

4.Write a JavaScript function to get the number of occurrences of each letter in Specified String.

5.Write a JavaScript function that accepts a number as a parameter and check the number is prime or not.

Conditional Statement & loops: -

1.Write a JavaScript program that accept two integers and display the larger one.

2.Write a JavaScript conditional statement to find the sign of entered three numbers.

3.Write a JavaScript Program that will iterate from 0 – 10. For every iteration it will check the number odd or even.

4.Write a JavaScript program that will print If the day is Sunday result will be 1. Like it should print for all day.

5.Write a JavaScript program to find the Armstrong numbers.

Arrays (use default array methods): - 1.Write a JavaScript program to concatenation of array – leetcode Problem1 2.Write a JavaScript program to find the maximum number of words in sentences – leetcode problem2

3.Write a JavaScript program to find maximum product difference between two pairs – leetcode problem3

4.Write a JavaScript program to find how many Numbers are smaller than the current number – leetcode problem4 5.Write a JavaScript program to find count Items matching a rule – leetcode problem5 6.Write a JavaScript program to check if the two string arrays are equivalent – leetcode problem6

7.Write a JavaScript program to count the number of pairs with absolute difference K – leetcode problem7 8.Write a JavaScript program to count the number of consistent Strings – leetcode problem8 9.Write a JavaScript program to count the equal and divisible pairs in an array – leetcode problem9 10.Write a JavaScript program to truncate the sentence with given number – leetcode problem10

Strings (use default string methods): - 1.Write a JavaScript program to solve the jewels and stones – leetcode problem1 2.Write a JavaScript program to shuffle a string – leetcode problem2 3.Write a JavaScript program to Split a String in balanced string – leetcode problem3 4.Write a JavaScript program to sort a sentence – leetcode problem4 5.Write a JavaScript program check If the sentence is pangram – leetcode problem5 6.Write a JavaScript program to Sort the people – leetcode problem6 7.Write a JavaScript program to lower case – leetcode problem7 8.Write a JavaScript program to reverse the string – leetcode problem8 9. Write a JavaScript program to replace all the digits with characters – leetcode problem9 10. Write a JavaScript program to count common words with One Occurrence – leetcode problem10

Recursion: -

1.Write a JavaScript program to calculate the factorial of number.

2.Write a JavaScript program to convert binary to decimal using recursion.

3.Write a JavaScript program to get the first n Fibonacci series using recursion.

4.Write a JavaScript program to check whether a given string is palindrome using recursion.

5.Write a JavaScript program to compute the sum of an array of integers using recursion.

Dates and Time: -

1.Write a JavaScript function to get the number of days in a month.

2.Write a JavaScript function to get the month name from a particular date.

3.Write a JavaScript function to get difference between the 2 dates.

4.Write a JavaScript function to calculate yesterday.

5.Write a JavaScript function to convert a Unix timestamp to time.

Objects (use default objects methods):

1.Write a JavaScript program to list the properties of JS Object.

2.Write a JavaScript program to delete a property from the Object.

3.Write a JavaScript program to sort an array of JS Object.

4.Write a JavaScript program to retrieve all the values of object properties.

5.Write a JavaScript program to check the object contain given property.

Map, Filter, Reduce, Sort:

1.Write a JavaScript program to sum of every positive element given array using filter and reduce. let arr = [1, -4,5, -3,6,7]

2.Write a JavaScript program to calculate the median and mean using the sort and reduce

Let arr = [12,46,32,64]

3.Write a JavaScript program to get an initial letter from each word from the sentence using map. Let input = ‘George Raymond Richard Martin’

Arrow Function:

1.Write a JavaScript program to find the Square a number using arrow function.

2.Write a JavaScript program to find the sum and difference for given 2 number using arrow function with one line execution.

3.Write a JavaScript program to find sum of the array using arrow function with one line execution. Let arr = [1,2,3,4,5,]

Promises:

1.Write a JavaScript program to make an API call using Promise and return the data.

2.Write a JavaScript program to make an alarm using Promise and setTimeout.

3.Write a JavaScript program to make a multiple API URL call using Promise.all

also use async await to solve above problems.

Callback functions:

1.Write a JavaScript program to find multiply, add for the given number using the callback.

2.Write a JavaScript program to get input from user using prompt and print it using callback.

3.Write a JavaScript program to remove the negative number from the array using callback.