(Ad, please don’t block.)

Quizzes » Callable values

1. Function calls

function callIt(func) {
  func();
}

Which of the following expressions throw exceptions?

2. new

function newIt(constr) {
  new constr();
}

Which of the following expressions throw exceptions?

3. Parameter default values

function foo(x=true, y) {
  return [x, y];
}
const result = foo('a', 'b', 'c');

What happens?

4. Parameter default values

function foo(x=true, y) {
  return [x, y];
}
const result = foo('a', 'b');

What happens?

5. Parameter default values

function foo(x=true, y) {
  return [x, y];
}
const result = foo('a');

What happens?

6. Parameter default values

function foo(x=true, y) {
  return [x, y];
}
const result = foo();

What happens?

7. Rest parameters

function f(x, ...y) {
  return [x, y];
}
const result = f('a', 'b', 'c');

What happens?

8. Rest parameters

function f(x, ...y) {
  return [x, y];
}
const result = f();

What happens?

9. Arrow function syntax

Which of the following expressions are syntactically correct?


Correct answers: 0 out of 0