Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
96 views

JavaScript Coding Questions

Coding questions js
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
96 views

JavaScript Coding Questions

Coding questions js
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

JAVASCRIPT CODING QUESTIONS

1. Write a JavaScript program that reverses a string.


2. Write a JavaScript program that checks if a given number is even or odd.
3. Find the largest number in an array.
4. Write a program that removes duplicates from an array.
5. Write a program that checks if a number is prime.
6. Write a program that checks if a given string contains only digits.
7. Write a program that counts how many times a specific element appears in an array.
8. Write a program that finds the longest word in a sentence
9. Write a program to find the missing number in an array of consecutive numbers.
10. Write a program that takes two sorted arrays and merges them into a single sorted array
without using any built-in sorting functions.
11. Write a function to check if a given string is a palindrome.
12. Write a program to reverse a string without using the built-in reverse() method.
13. Given an array of numbers, write a function to find the largest and smallest numbers in
the array.
14. Given a string, write a function to count the occurrences of each character in the string.
15. Write a program to remove duplicates from an array.
16. Write a program that takes an array of integers and returns the largest difference
between any two numbers in the array.
17. Write a program that checks if a given string is an anagram of another string (contains
the same characters in a different order).
18. Write a program that finds the second smallest element in an array of integers.
19. Write a function that generates a random alphanumeric string of a given length.
20. Write a program that sorts an array of numbers in ascending order.
21. Write a program that checks if a number is a perfect number.
22. Write a program to find the first non-repeating character in a string.
23. Write a program that converts a string to title case (capitalising first letter of each word).
24. Write a program that counts the number of vowels in a string.
25. Write a program that accepts a sentence and returns the number of words in it.
26. Write a program that checks if a given number is a power of two.
27. Write a JavaScript program that returns the first n numbers in the Fibonacci sequence.
28. Write a program that returns a new array containing all elements that are present in both
arrays. The returned array should not contain duplicates.

You might also like