es2015 quiz

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

Upload: sergey-bolshchikov

Post on 11-Apr-2017

676 views

Category:

Software


0 download

TRANSCRIPT

Page 1: ES2015 Quiz

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

Page 2: ES2015 Quiz

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

Page 3: ES2015 Quiz

ES6 KingES2015

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

Page 4: ES2015 Quiz

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Page 5: ES2015 Quiz

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Page 6: ES2015 Quiz

Rules4 teams

4 possible answers1 minute per question

1 winner

The answer must be explained

12 questions

Page 7: ES2015 Quiz

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Page 8: ES2015 Quiz

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Page 9: ES2015 Quiz

Rules4 teams

4 possible answers

1 minute per question

1 winner

The answer must be explained

12 questions

Page 10: ES2015 Quiz

Ready?Steady!Go!

Page 11: ES2015 Quiz

01

Question01

Page 12: ES2015 Quiz

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

Page 13: ES2015 Quiz

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

Page 14: ES2015 Quiz

01

Question02

Page 15: ES2015 Quiz

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

Page 16: ES2015 Quiz

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

Page 17: ES2015 Quiz

01

Question03

Page 18: ES2015 Quiz

What’s the result of this code?

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

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

Page 19: ES2015 Quiz

What’s the result of this code?

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

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

Page 20: ES2015 Quiz

01

Question04

Page 21: ES2015 Quiz

(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

Page 22: ES2015 Quiz

(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

Page 23: ES2015 Quiz

01

Question05

Page 24: ES2015 Quiz

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

What’s the result of this code?

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

Page 25: ES2015 Quiz

What’s the result of this code?

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

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

Page 26: ES2015 Quiz

01

Question06

Page 27: ES2015 Quiz

typeof (function* f() {

yield f;

})().next()

What’s the result of this code?

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

Page 28: ES2015 Quiz

typeof (function* f() {

yield f;

})().next()

What’s the result of this code?

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

Page 29: ES2015 Quiz

01

Question07

Page 30: ES2015 Quiz

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

Page 31: ES2015 Quiz

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

Page 32: ES2015 Quiz

01

Question08

Page 33: ES2015 Quiz

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]

Page 34: ES2015 Quiz

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]

Page 35: ES2015 Quiz

01

Question09

Page 36: ES2015 Quiz

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

Page 37: ES2015 Quiz

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

Page 38: ES2015 Quiz

01

Question10

Page 39: ES2015 Quiz

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)

Page 40: ES2015 Quiz

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)

Page 41: ES2015 Quiz

01

Question11

Page 42: ES2015 Quiz

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);

Page 43: ES2015 Quiz

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);

Page 44: ES2015 Quiz

01

Question12

Page 45: ES2015 Quiz

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]));

Page 46: ES2015 Quiz

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]));

Page 47: ES2015 Quiz

And the winner is...