JavaScript Practice Tasks
🔹 Beginner Level (Tasks 1–10)
1. Print "Hello, World!"
Write a script to display "Hello, World!" in an alert box.
2. Simple Calculator
Prompt the user for two numbers and display their sum.
3. Check Even or Odd
Prompt a number and display whether it's even or odd.
4. Temperature Converter
Convert Celsius to Fahrenheit using the formula: F = (C × 9/5) + 32.
5. String Length
Ask the user to enter a string and display its length.
6. Swap Two Variables
Swap values of two variables without using a third variable.
7. Simple Interest Calculator
Calculate simple interest: SI = (P × R × T) / 100.
8. Square a Number
Ask the user for a number and display its square.
9. Display Current Date and Time
Show the current date and time using the Date() object.
10. Check Leap Year
Ask the user for a year and determine if it's a leap year.
🔹 Intermediate Level (Tasks 11–20)
11. Palindrome Checker
Ask for a word and check if it's a palindrome.
12. Reverse a String
Ask for a string and display its reverse.
13. Factorial Calculator
Find the factorial of a number entered by the user.
14. Multiplication Table
Display a multiplication table for a number (1 to 10).
15. Count Vowels in a String
Count the number of vowels in a user-input string.
16. Simple To-Do List (Console Based)
Allow a user to add and remove items to/from an array-based to-do list.
17. Find Largest of Three Numbers
Prompt three numbers and display the largest.
18. Grade Calculator
Input marks and display the grade based on average.
19. Generate Random Number
Generate a random number between 1 and 100.
20. Validate Email Address
Prompt an email and check if it contains @ and ..
🔹 Event and DOM Based Tasks (Tasks 21–30)
21. Change Background Color
Add a button that changes the background color when clicked.
22. Live Character Counter
Count and display the number of characters in a textbox as the user types.
23. Form Validation
Validate a form that checks if all fields are filled before submission.
24. Show/Hide Password
Toggle password visibility using a checkbox.
25. Simple Image Slider
Cycle through images every 3 seconds using setInterval().
26. Click Counter
Increase and display a counter each time a button is clicked.
27. Change Text on Hover
Change a paragraph's content when the mouse hovers over it.
28. Dark/Light Mode Toggle
Add a button that switches between dark and light modes.
29. Create a Dropdown Menu
Use JavaScript to populate and handle a dropdown selection.
30. Display List from Array
Given an array of items, dynamically display them in an HTML list.