1.
What is the purpose of the following JavaScript statement? let name = "John";
2.
Which of the following JavaScript statements is used to execute different code based on a specified condition?
3.
What will be the output of the following JavaScript code? Code: let x = 15; if (x > 10) { console.log("x is greater than 10"); } else { console.log("x is not greater than 10"); }
4.
What does the following JavaScript code snippet do? Code: let num = 5; while (num > 0) { console.log(num); num--; }
5.
What will be the output of the following JavaScript code? Code: for (let i = 0; i <= 3; i++) { console.log(i); }
6.
What does the following JavaScript code snippet do? Code: let numbers = [1, 2, 3, 4, 5]; let sum = 0; for (let num of numbers) { sum += num; } console.log(sum);
7.
What is the purpose of the following JavaScript statement? let result = x > 0 ? "Positive" : "Non-positive";
8.
What will be the output of the following JavaScript code? Code: let count = 0; do { console.log(count); count++; } while (count < 3);
9.
What is the purpose of the following JavaScript statement? break;
10.
Which of the following JavaScript statements is used to execute a block of code repeatedly while a condition remains true?