ES2015 Quiz

Post on 11-Apr-2017

678 views 0 download

Transcript of ES2015 Quiz

ES6 KingInteractive fun quiz about new generation of JavaScript for your front end developers that will make them sweat and swear

ES6 KingInteractive fun quiz about new generation of JavaScript for your front end developers that will make them sweat and swear

ES6 KingES2015

Interactive fun quiz about new generation of JavaScript for your front end developers that will make them sweat and swear

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Rules4 teams

4 possible answers1 minute per question

1 winner

The answer must be explained

12 questions

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Ready?Steady!Go!

01

Question01

let x = 42;

if (true) {

console.log(x);

let x = 1337;

}

What’s the result of the console.log operation?

1. 422. undefined3. Error4. 1337

let x = 42;

if (true) {

console.log(x);

let x = 1337;

}

What’s the result of the console.log operation?

1. 422. undefined3. Error4. 1337

01

Question02

var x = `foo ${y}`,

y = `bar ${x}`;

console.log(y);

What’s the result of this code?

1. bar foo bar undefined

2. bar foo undefined

3. bar foo4. InternalError

What’s the result of this code?

var x = `foo ${y}`,

y = `bar ${x}`;

console.log(y);

1. bar foo bar undefined

2. bar foo undefined

3. bar foo4. InternalError

01

Question03

What’s the result of this code?

1. 12. 33. [1,2,3]4. Error

((...x, xs)=>x)(1,2,3)

What’s the result of this code?

((...x, xs)=>x)(1,2,3)

1. 12. 33. [1,2,3]4. Error

01

Question04

(new function f () {

this.a = 1;

return ((...b) => {

return this.a;

}).bind({ a: 9 });

})();

What’s the result of this code?

1. 92. undefined3. TypeError4. 1

(new function f () {

this.a = 1;

return ((...b) => {

return this.a;

}).bind({ a: 9 });

})();

What’s the result of this code?

1. 92. undefined3. TypeError4. 1

01

Question05

let x, { x: y = 1 } = { x }; y;

What’s the result of this code?

1. undefined2. 1 3. {x: 1}4. Error

What’s the result of this code?

let x, { x: y = 1 } = { x }; y;

1. undefined2. 1 3. {x: 1}4. Error

01

Question06

typeof (function* f() {

yield f;

})().next()

What’s the result of this code?

1. “function”2. “generator”3. “object”4. Error

typeof (function* f() {

yield f;

})().next()

What’s the result of this code?

1. “function”2. “generator”3. “object”4. Error

01

Question07

class MyClass {

const MY_CONST = 'string';

constructor() {

this.MY_CONST;

}

}

let myClass = new MyClass();

console.log(myClass.MY_CONST);

What’s the result of this code?

1. ‘string’2. SyntaxError3. undefined4. ReferenceError

class MyClass {

const MY_CONST = 'string';

constructor() {

this.MY_CONST;

}

}

let myClass = new MyClass();

console.log(myClass.MY_CONST);

What’s the result of this code?

1. ‘string’2. SyntaxError3. undefined4. ReferenceError

01

Question08

function* g() {

return 1;

}

for (let i of g())

console.log(i);

What’s the result of this code?

1. 12. Error3. undefined4. [object Object]

function* g() {

return 1;

}

for (let i of g())

console.log(i);

What’s the result of this code?

1. 12. Error3. undefined4. [object Object]

01

Question09

let popo = (function*() {

console.log([yield, yield]);

}());

popo.next(1);

popo.next(2);

popo.next(3);

What’s the result of this code?

1. [1,2]2. [2,3]3. [1,undefined]4. Error

let popo = (function*() {

console.log([yield, yield]);

}());

popo.next(1);

popo.next(2);

popo.next(3);

What’s the result of this code?

1. [1,2]2. [2,3]3. [1,undefined]4. Error

01

Question10

What’s the result of this code?

1. f, f, f2. f, t, f3. f, t, t4. t, t, t

class X {}

class Y extends X {}

console.log(Object.getPrototypeOf(X) ===

Function.prototype);

console.log(Object.getPrototypeOf(Y) === X);

console.log(Object.getPrototypeOf(new Y()) ===

Y.prototype)

What’s the result of this code?

1. f, f, f2. f, t, f3. f, t, t4. t, t, t

class X {}

class Y extends X {}

console.log(Object.getPrototypeOf(X) ===

Function.prototype);

console.log(Object.getPrototypeOf(Y) === X);

console.log(Object.getPrototypeOf(new Y()) ===

Y.prototype)

01

Question11

What’s the result of this code?

1. []2. [2,3,4,5,1]3. [5,4,3,2,1]4. Error

let f = (x, ...y) => x?[...f(...y), x]:[];

let arr = [], i = 0;

for (arr[i++] of f(1,2,3,4,5)) {}

console.log(arr);

What’s the result of this code?

1. []2. [2,3,4,5,1]3. [5,4,3,2,1]4. Error

let f = (x, ...y) => x?[...f(...y), x]:[];

let arr = [], i = 0;

for (arr[i++] of f(1,2,3,4,5)) {}

console.log(arr);

01

Question12

What’s the result of this code?

1. [1,2]2. 33. 44. 5 let m = new Map([[1,2],[[1,2],3],[2,4],[3,5]]);

console.log(m.get([...m][1][1]));

What’s the result of this code?

1. [1,2]2. 33. 44. 5 let m = new Map([[1,2],[[1,2],3],[2,4],[3,5]]);

console.log(m.get([...m][1][1]));

And the winner is...