Tricky ES6 JavaScript Quiz
by Kwiz
Qs
18
Difficulty
Mid
Plays
15
Record
n/a
Description

Some tricky ES6-focused JavaScript questions in a quiz originally published at: https://maxwellito.github.io/es6-quiz-slides

Question Preview
What is the output?
const KEY = "white_rabbit";
if (true) {
  const KEY = "ginger_rabbit";
}
console.log(KEY);
Question Preview
What's the output?
let x = 42;
if (true) {
  let x = 1337;
}
console.log(x);
Question Preview
What's the output?
let x = 42;
if (true) {
  console.log(x);
  let x = 1337;
}
Question Preview
What's the output?
var x = `foo ${y}`,
    y = `bar ${x}`;

console.log(x);
Question Preview
What's the output?
var x = `foo ${y}`,
    y = `bar ${x}`;

console.log(y);
Question Preview
What's the attribute to get the quantity of objects stored in a `Set` object?
Question Preview
What's the difference between Map/Set and WeakMap/WeakSet ?
Question Preview
Which keyword is allowed in ES6 Class definition?
Question Preview
The following code will run without error
var score = [12, 7, 14];
Math.max(...score);
Question Preview
The following code will run without error
function stuff(x::Number, y::String) {
  // Do stuff..
}
Question Preview
The following code will run without error
function stuff(x, ...y) {
  // Do stuff..
}
Question Preview
The following code will run without error
function stuff(x, y=12) {
  // Do stuff..
}
stuff(2);
Question Preview
The following code will run without error
function stuff(x, y=x/3) {
  // Do stuff..
}
stuff(6);
Question Preview
The following code will run without error
var {foo, bar} = {
  foo: 'FOO',
  bar: 'BAR'
};
Question Preview
The following code will run without error
var [first, , last] = [1,2,3];
Question Preview
The following code will run without error
function stuff(a, x=12, y=42) {
  // Do stuff..
}
stuff(1, ,2);
Question Preview
What does the Promise constructor take as parameter(s)?
Question Preview
Is there a method to take a lot of promises, wrap them into one which will be resolved (or rejected) once one of them will be resolved?