Are you ready?
1 questions to solve.
Instructions
- This quiz goes to full-screen once you press the Start button.
- At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
How to declare a variable in JavaScript?
The
var
keyword is used to declare variables in JavaScript. Hence, the correct choice is (C). For more details, refer to JavaScript Basics — Variables.What does the following code log?
var x = 10;
console.log(x + 10);
In this code,
x
holds the number 10
, hence x + 10
literally translates to 10 + 10
which gives 20
. The correct choice is therefore (A). For more details, refer to JavaScript Basics — Variables.Which of the following definitions best describes a string?
A string is a sequence of textual characters. This goes with choice (D). For more details, refer to JavaScript Basics — Strings.
Which of the following values denotes a string?
In JavaScript, a string could be denoted using single quotes (
''
) or double quotes (""
). Hence, both 'Hello'
and "Hello"
are strings. The correct choice is therefore (C). For more details, refer to JavaScript Basics — Strings.Which of the following denotes the three functions in JavaScript that display dialog boxes?
The functions
alert()
, confirm()
and prompt()
display dialog boxes. Hence, the correct choice is (A). For more details, refer to JavaScript Basics — Dialog boxes.What does the following code log?
console.log(Number('10'));
Passing a string to the
Number()
function returns back the equivalent number. In this case, we get back the number 10
, which consequently gets logged in the console. The correct choice is therefore (B). For more details, refer to JavaScript Basics — Conversion to number.