Simple JavaScript Quiz

Test your knowledge in JavaScript Fundamentals

1. Which is not a primitive data type in JavaScript?

a. boolean
b. number
c. string
d. character

2. Which of these will throw a SyntaxError?

a. if (x == 1) { }
b. if (x = 1) { }
c. if (x ==== 1) { }
d. if (x === 1) { }

3. The var statement is used to:

a. Create a new local variable
b. Retrieve a variable descriptor
c. Declare a member of a class
d. Change a constant

4. What is the difference between == and === ?

a. The == is used in comparison, and === is used in value assignment.
b. The == operator converts both operands to the same type, whereas === returns false for different types.

5. Which of the following operators can assign a value to a variable?

a. =
b. +=
c. %=
d. All of these