JavaScript Practice Questions (Beginner to Advanced)
1. Basic Syntax and Operations
1. Write a function to add two numbers.
2. Create a function to check if a number is even or odd.
3. Write a program to calculate the factorial of a number.
4. Develop a function to find the GCD of two numbers.
5. Write a function that reverses a given string.
6. Create a function to check if a string is a palindrome.
7. Write a program to generate the Fibonacci sequence up to a given number.
8. Implement a function to find the largest number in an array.
9. Write a function to calculate the power of a number using recursion.
10. Develop a program to sort an array in ascending order.
2. String Manipulation
1. Write a function to count the number of vowels in a string.
2. Create a function to find the longest word in a string.
3. Write a program to replace all spaces in a string with hyphens.
4. Develop a function to capitalize the first letter of each word in a string.
5. Write a function to remove all duplicate characters from a string.
6. Create a program to check if two strings are anagrams.
7. Write a function to truncate a string to a given number of characters.
8. Develop a function to extract numbers from a string.
9. Write a function to reverse the words in a string.
10. Create a program to convert a string to camel case.
3. Array Operations
1. Write a function to find the second largest number in an array.
2. Create a program to remove duplicates from an array.
3. Write a function to find the sum of all elements in an array.
4. Develop a program to rotate an array by a given number of positions.
5. Write a function to find the intersection of two arrays.
6. Create a program to find the union of two arrays.
7. Write a function to find the difference between two arrays.
8. Develop a program to find the frequency of elements in an array.
9. Write a function to merge two sorted arrays into one sorted array.
10. Create a program to split an array into chunks of a given size.
4. Object Manipulation
1. Write a function to merge two objects.
2. Create a program to find keys with the highest value in an object.
3. Write a function to check if an object is empty.
4. Develop a program to count the number of properties in an object.
5. Write a function to clone an object.
6. Create a program to invert the keys and values of an object.
7. Write a function to deep merge two objects.
8. Develop a program to filter object properties based on a condition.
9. Write a function to compare two objects for equality.
10. Create a program to convert an object to an array.
5. DOM Manipulation
1. Write a program to change the text content of a paragraph on a button click.
2. Create a program to toggle the visibility of an element.
3. Write a function to add a new list item to an unordered list.
4. Develop a program to update the background color of a webpage dynamically.
5. Write a function to validate form inputs and display error messages.
6. Create a program to fetch and display data from an API.
7. Write a function to implement a real-time search filter.
8. Develop a program to create a simple image carousel.
9. Write a function to dynamically add and remove table rows.
10. Create a program to implement infinite scrolling.
6. Asynchronous Operations
1. Write a program to fetch data from an API and display it in a table.
2. Create a function to handle multiple API requests concurrently.
3. Write a program to simulate a delay using Promises.
4. Develop a program to chain multiple asynchronous operations.
5. Write a function to retry a failed API request.
6. Create a program to implement a simple progress bar for file uploads.
7. Write a function to fetch and display images from an API.
8. Develop a program to create a countdown timer using Promises.
9. Write a function to debounce a search input field.
10. Create a program to throttle button click events.