-
Q1: Create a variable named age and store your age in it. Print it in the console. Tag: #VariablesForNumbers Expected Output: Your age (for example 20)
-
Q2: Create two variables apples and oranges. Add both and print total fruits. Tag: #VariablesForNumbers #MathExpression Expected Output: Sum of both numbers.
-
Q3: Create a variable price and discount. Subtract discount from price and show the final price. Tag: #VariablesForNumbers #MathExpression Expected Output: Final price after subtraction.
-
Q4: Write five different variable names, and mark which are legal or illegal in JavaScript. (Example: let userName, let 123name, etc.) Tag: #VariableNames Expected Output: Only legal variable names should work without an error.
-
Q5: Try to create a variable with a space in its name (like let my name = "Ali";) See what happens. Tag: #VariableNames Expected Output: You should get a syntax error. Then fix it correctly.
-
Q6: Make a variable using $ or _ in its name and print it. Tag: #VariableNames Expected Output: Value printed correctly.
-
Q7: Create two number variables and multiply them. Tag: #MathExpression #FamiliarOperators Expected Output: Product of both numbers.
-
Q8: Divide one number by another and show the result in console. Tag: #MathExpression #FamiliarOperators Expected Output: Division result.
-
Q9: Find the remainder when one number is divided by another (use % operator). Tag: #MathExpression #FamiliarOperators Expected Output: Remainder value.
-
Q10: Write an expression that adds 5 and 10 and subtracts 3. Tag: #MathExpression #FamiliarOperators Expected Output: 12
-
Q11: Create a variable marks with value 50. Then increase it by 10 using marks = marks + 10. Print the result. Tag: #FamiliarOperators Expected Output: 60
-
Q12: Create a variable num1 = 10, num2 = 5. Print the result of all operations:
addition
subtraction
multiplication
division Tag: #FamiliarOperators #MathExpression Expected Output: Should show all operation results.
-
Q13: Create a variable a = 5. Use post-increment (a++) and then print the value. Tag: #UnfamiliarOperators #PostIncrement Expected Output: 6
-
Q14: Create a variable b = 7. Use pre-increment (++b) and print the result. Tag: #UnfamiliarOperators #PreIncrement Expected Output: 8
-
Q15: Create a variable c = 10. Use post-decrement (c--) and print the result. Tag: #UnfamiliarOperators #PostDecrement Expected Output: 9
-
Q16: Make a variable score = 20. Increase it by 5 using += operator, then print the final score. Tag: #UnfamiliarOperators #AssignmentOperator Expected Output: 25
-
Q17: Make a variable count = 10. Decrease it by 3 using -= operator and print it. Tag: #UnfamiliarOperators #AssignmentOperator Expected Output: 7