(Ad, please don’t block.)

Quizzes » Syntax (advanced)

1. Which of the following are legal variable names?

2. Which of these pieces of code can appear in expression context?

3. Which of these pieces of code can appear in statement context?

4. Semicolons

function foo() {
  bar() // A
} // B

After which line(s) does one usually put semicolons?

5. Semicolons

function foo() {} // A
const foo = function () {} // B

After which line(s) does one usually put semicolons?

6. Semicolons

while (a > 0) a-- // A
while (a > 0) {
  a-- // B
} // C

Semicolon after:

7. Automatic semicolon insertion (ASI) (1/2)

function f() {
  return
  {
    a: 1 // (A)
  }
}
const result = f();

What happens?

8. Automatic semicolon insertion (ASI) (2/2)

const arr = Object.keys({a: 1, b: 2, c: 3})
[1].forEach(x => console.log(arr[x]))


Correct answers: 0 out of 0