NEW
Font size
WorksheetsMastering JavaScript Variables and Conditions
Total questions: 10
Worksheet time: 5mins
What keyword is used to declare a variable in JavaScript?
define
assign
var, let, const
initialize
Which of the following is NOT a data type in JavaScript: String, Number, Character, Boolean?
Array
Character
Decimal
Text
What will the following code output: console.log(typeof 42);?
string
number
boolean
undefined
How do you declare a constant variable in JavaScript?
const variableName = value;
let variableName = value;
var variableName = value;
constant variableName = value;
What is the result of the expression true && false?
undefined
true
false
null
Which statement is used to execute a block of code if a specified condition is true?
when statement
if statement
loop statement
case statement
What is the output of the following code: console.log(5 == '5');?
undefined
false
NaN
true
Which operator is used to check for both value and type equality in JavaScript?
<=
!==
===
==
What will the following code return: console.log(3 > 2 && 2 < 1);?
null
true
false
undefined
How do you write an if statement that checks if a variable 'x' is greater than 10?
if (x > 10) { ... }
if (x >= 10) { ... }
if (x == 10) { ... }
if (x < 10) { ... }
