[Go to site: main page, start]

0% found this document useful (0 votes)
6 views3 pages

JavaScript Programming Challenges List

The document contains a list of JavaScript programming questions and tasks aimed at testing various coding skills. It includes exercises on loops, functions, array manipulations, string operations, and mathematical calculations. Each task specifies the requirements and expected outputs for the coding challenges.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

JavaScript Programming Challenges List

The document contains a list of JavaScript programming questions and tasks aimed at testing various coding skills. It includes exercises on loops, functions, array manipulations, string operations, and mathematical calculations. Each task specifies the requirements and expected outputs for the coding challenges.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

JAVASCRIPT QUESTIONS

1. Print numbers from 1 to 10


2. Print the odd numbers less than 100
3. Print the multiplication table with 7
4. Print all the multiplication tables with numbers from 2 to 10
5. Calculate the sum of numbers from 1 to 10
6. Calculate 10! (Factorial of 10).
7. Calculate the sum of odd numbers greater than 10 and less than 30.
8. Calculate the sum of numbers in an array of numbers. (Take a minimum of 8
numbers in the array).
9. Calculate the average of the numbers in an array of numbers. (Take a minimum of 8
numbers in the array).
10. Create a function that receives an array of numbers and returns an array containing
only the positive numbers. ( Take min 10 elements consisting of at least four negative
numbers)
11. Calculate the sum of digits of a positive integer number. (The number should contain
at least 4 digits. For example if the number is 4673, the output should be 20 i.e.
addition of the digits.)
12. Rotate an array to the left 1 position (For example if array elements are 2,8,3 after
rotation it should be 8,3,2)
13. Rotate an array to the right 1 position (For example if array elements are 2,8,3 after
rotation it should be 3,2,8)
14. Find the maximum number in an array of numbers (Take a minimum of 8 numbers in
the array).
15. Create a function that will return a Boolean specifying if a number is prime.
16. Create a function to reverse an array of numbers.(Take a minimum of 8 numbers in
the array).
17. Create a function to reverse a string.
18. Create a function that will merge two arrays and return the result as a new array
19. Create a function that will receive two arrays of numbers as arguments and return an
array composed of all the numbers that are either in the first array or second array
but not in both. let ar1 = [1, 2, 3, 10, 5, 3, 14] ;let ar2 = [1, 4, 5, 6, 14];
20. Create a function that will receive two arrays and will return an array with elements
that are in the first array but not in the second. let ar1 = [1, 2, 3, 10, 5, 3, 14]; let ar2 =
[-1, 4, 5, 6, 14];
21. Create a function that takes an integer as an argument and returns "Even" for even
numbers or "Odd" for odd numbers.
22. Century From Year
The first century spans from the year 1 up to and including the year 100, The second
- from the year 101 up to and including the year 200, etc. Given a year, return the
century it is in.
function century(year) {
// Your solution
};

[Link](century(1705)); // 18
[Link](century(1900)); // 19
[Link](century(1601)); // 17
[Link](century(2000)); // 20
[Link](century(89)); // 1

23. Write a function that takes any non-negative integer as an argument and returns it
with its digits in descending order. Essentially, rearrange the digits to create the
highest possible number.

const descendingOrder = n => {


// Your solution
};

[Link](descendingOrder(0)); // 0
[Link](descendingOrder(1)); // 1
[Link](descendingOrder(1021)); // 2110
[Link](descendingOrder(42145)); // 54421
[Link](descendingOrder(145263)); // 654321
[Link](descendingOrder(123456789)); // 987654321

24. Write a JS program to input a number from user and swap first and last digit of the
given number.
Example-
Input any number: 12345
Output Number after swapping first and last digit: 52341

25. Write a JS program to check whether the input character is vovel or consonant.
26. Write a Simple Calculator Program using switch Statement
27. Consider the following array
const inputWords = ["spray", "limit", "elite", "exuberant", "destruction", "present"];
Write JavaScript statements that will produce the following output:
["exuberant", destruction", "present"]
28. The given input is a string of multiple words with a single space between each of
them. Abbreviate the name and return the name initials.
If input is ……….const input = "George Raymond Richard Martin";
Output should be……….."GRRM"; (HINT: Use Javascript Array Iteration map
method)
29. Write a function that takes an array of numbers as input and returns a new
array with all the numbers doubled.
30. Write a function that takes an array of numbers as input and returns the
second-highest number in the array.
31. Write a program that prints the numbers from 1 to 100. But for multiples of
three, print “Fizz” instead of the number, and for the multiples of five, print
“Buzz”. For numbers that are multiples of both three and five, print “FizzBuzz”.
32. Write a function that takes a string as a parameter and returns whether it’s a
palindrome (reads the same forward and backward).
33. Write a JavaScript function that accepts a string as a parameter and converts
the first letter of each word of the string in upper case. Example string : 'the
quick brown fox' Expected Output : 'The Quick Brown Fox ' .
34. Write a JavaScript program to calculate multiplication and division of two
numbers (input from user).

Strings
● Create a function called mixUp. It should take in two strings, and return the
concatenation of the two strings (separated by a space) slicing out and swapping the
first 2 characters of each. You can assume that the strings are at least 2 characters
long. For example:
mixUp('mix', pod'): Output should be— 'pox mid'
mixUp('dog', 'dinner'):Output should be— 'dig donner'
● Create a function called verbing. It should take a single argument, a string. If its
length is at least 3, it should add 'ing' to its end, unless it already ends in 'ing', in which
case it should add 'ly' instead. If the string length is less than 3, it should leave it
unchanged. For example:
verbing('swim'): 'swimming'
verbing('swimming'): 'swimmingly'
verbing('go'): 'go'

You might also like