What is the output?
Anonymous Quiz
11%
1 5 hello missing:z
49%
1 10 hello missing:z
30%
1 10 hello undefined
10%
undefined 10 hello missing:z
❤1🤔1
CHALLENGE
const sym = Symbol('id');
const target = { a: 1, [sym]: 2 };
Reflect.defineProperty(target, 'b', { value: 3, enumerable: false });
const handler = {
get(obj, prop, receiver) {
if (prop === 'a') return Reflect.get(obj, prop, receiver) * 10;
return Reflect.get(obj, prop, receiver);
}
};
const proxy = new Proxy(target, handler);
console.log(proxy.a, proxy.b, Reflect.ownKeys(target).length, Object.keys(target).length);👍2🔥1
CHALLENGE
let a = 0;
let b = null;
let c = '';
let d;
a ||= 10;
b ??= 20;
c &&= 'changed';
d ??= a + b;
console.log(a, b, c, d);
❤2👍2🔥1
CHALLENGE
function build(a, b = a + 1, c = (() => a + b)()) {
a = 100;
return [a, b, c];
}
console.log(build(1), build(1, 2), build(5, 5, 5));CHALLENGE
let outerType;
{
function greet() {
return 'inner';
}
outerType = typeof greet;
}
console.log(outerType, typeof greet);
❤1
What is the output?
Anonymous Quiz
25%
function undefined
36%
undefined function
20%
undefined undefined
19%
function function
CHALLENGE
const x = 2n ** 10n;
const y = 7n / 2n;
const z = -7n / 2n;
const w = BigInt(3.0) === 3n;
console.log(`${x} ${y} ${z} ${typeof x} ${w}`);
❤5
What is the output?
Anonymous Quiz
17%
1024 4 -4 bigint true
37%
1024 3 -3 bigint true
24%
1024 3 -3 bigint false
21%
1024n 3n -3n bigint true
👍3❤2
CHALLENGE
const obj = { a: { b: null, getC: () => 42 } };
let calls = 0;
function sideEffect() {
calls++;
return 10;
}
const result = obj.a?.b?.getC?.() ?? sideEffect();
const result2 = obj.a?.z?.getC?.() ?? sideEffect();
console.log(result, result2, calls);👍2❤1🔥1
What is the output?
Anonymous Quiz
23%
undefined 10 2
18%
10 10 1
32%
undefined undefined 2
27%
10 10 2
🤔2❤1
CHALLENGE
const counter = {
count: 0,
*[Symbol.iterator]() {
yield this.count++;
yield this.count++;
yield this.count++;
}
};
console.log([...counter], counter.count);
export {};What is the output?
Anonymous Quiz
22%
[ 0, 1, 2 ] 2
37%
[ 0, 1, 2 ] 0
28%
[ 0, 1, 2 ] 3
13%
[ 1, 2, 3 ] 3
❤1