## Are you ready?

**1** questions to solve.

Instructions

- This quiz goes to full-screen once you press the Start button, or any Next button after exiting the quiz window.
- At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.

A statement and expression is the same thing in JavaScript. True or false?

Indeed,

**and***statements***are two different concepts in JavaScript. For more details, refer to JavaScript Basics.***expressions*All expressions are statements but not all statements are expressions. True or false?

All expressions in JavaScript could also be termed as

**, and are therefore statements. But the same does not hold for statements. All statements are not expressions. For more details, refer to JavaScript Basics.***expression statement*Which of the following definitions best fits with the idea of an expression?

An

**is a piece of code that***expression**resolves down*— or in other words, evaluates — to a given value. This goes with choice (B). For more details, refer to JavaScript Basics — Expressions.Is

`5 + 5`

an expression or a statement?`5 + 5`

is an expression, and since all expressions are also statements, it is a statement as well. This goes with choice (C). For more details, refer to JavaScript Basics.Which of the following denotes a primary expression?

Numbers and strings, in their literal forms, denote primary expressions. Hence the correct answer for this question is (D). For more details, refer to JavaScript Basics — Expressions.

`null`

is a primary expression in JavaScript. True or false?Indeed,

`null`

is a primary expression, as it doesn't contain any other expression in itself. Hence, the correct choice is (A). For more details, refer to JavaScript Basics — Primary Expressions.What would the following code log?

`console.log(50 != 5);`

`!=`

is the *not-equal*operator. It returns

`true`

when the given values are not equal to one another. In this case, since `50`

is not equal to `5`

, we get `true`

returned, and consequently logged. For more details, refer to JavaScript Basics — Relational Expressions.What would the following code log?

`console.log(10 == 10);`

`==`

is the *equal*operator. It returns

`true`

when the given values are equal to one another, and `false`

otherwise. In this case, since `10`

is indeed equal to `10`

, we get `true`

returned, and consequently logged. For more details, refer to JavaScript Basics — Relational Expressions.How to declare a variable in JavaScript?

The

**keyword is used to declare variables in JavaScript. Hence, the correct choice is (C). For more details, refer to JavaScript Basics — Variables.**`var`

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.