JavaScript Practice Q
1. Write a JavaScript program to declare variables using var, let, and const. Assign
appropriate values and display them using [Link]().
2. Write a JavaScript program that:
Takes two numbers
Performs addition, subtraction, multiplication, division, and modulus
Displays the results
3. Demonstrate the use of assignment operators (=, +=, -=, *=, /=) with a suitable
example.
4. Write a program to compare two numbers using:==, ===, !=, >, <, >=, <= Display
meaningful messages based on comparison results.
5. Create a program to check student eligibility using logical operators (&&, ||, !) based
on:
Marks
Attendance
6. Write a JavaScript program demonstrating:
Pre-increment and post-increment
Pre-decrement and post-decrement
7. Develop a JavaScript program that acts as a basic calculator using variables and
operators.
8. Write a program to:
Declare variables of different data types
Use typeof operator to display their types
9. Create a JavaScript program to calculate:
Total bill amount
Apply discount using operators
Display final payable amount
10. Write a JavaScript program to swap two numbers:
Using a temporary variable
Without using a temporary variable
11. Write a JavaScript program to check whether a given number is even or odd using
operators only.
12. Write a JavaScript program to determine whether a number is:
Positive
Negative
Zero
13. Develop a JavaScript program to calculate Simple Interest using the formula.
14. Write a JavaScript program to calculate:
Area of a rectangle
Area of a circle
Use appropriate variables and operators.
15. Create a program that applies:
10% discount if bill > ₹2000
5% discount if bill > ₹1000
Display final payable amount.
16. Write a JavaScript program to check whether a person is eligible to vote based on age.
17. Write a program to check whether a student passes based on marks in three subjects
(minimum 40 in each).
18. Create a JavaScript program that validates:
Age
Salary
Experience
using logical and comparison operators.
19. Write a JavaScript program to find the largest of three numbers using comparison
operators.
20. Develop a JavaScript program to calculate Body Mass Index (BMI) using:
weight
BMI = 2
Height