What is the output?
Anonymous Quiz
25%
1 11 30 true
35%
1 11 31 true
33%
undefined 11 30 true
7%
1 10 30 true
CHALLENGE
const sym1 = Symbol('id');
const sym2 = Symbol('id');
const obj = {
[sym1]: 'first',
[sym2]: 'second',
regular: 'value'
};
const s = Symbol.for('shared');
const s2 = Symbol.for('shared');
console.log(
sym1 === sym2,
Object.keys(obj).length,
Reflect.ownKeys(obj).length,
s === s2,
sym1.toString()
);❤1
What is the output?
Anonymous Quiz
27%
false 1 3 false Symbol(id)
42%
true 1 3 true Symbol(id)
23%
false 1 3 true Symbol(id)
8%
false 3 3 true Symbol(id)
🔥3❤2👍1
CHALLENGE
function tag(strings, ...values) {
return strings.raw.join('|') + '::' + values.join(',');
}
const a = 5, b = 10;
console.log(tag`Sum:\n${a + b} End`);What is the output?
Anonymous Quiz
31%
Sum:\n| End::5,10
34%
Sum:\n End::15
25%
Sum:\n| End::15
9%
Sum: End::15
CHALLENGE
const a = -7 % 3;
const b = 7 % -3;
const c = 2 ** 3 ** 2;
const d = (2 ** 3) ** 2;
const e = 0.1 + 0.2;
console.log(a, b, c, d, e);
What is the output?
Anonymous Quiz
15%
-1 1 512 64 0.3
52%
-1 1 512 64 0.30000000000000004
25%
-1 1 64 512 0.30000000000000004
8%
1 -1 512 64 0.30000000000000004
CHALLENGE
async function main() {
const settled = await Promise.allSettled([
Promise.resolve(1),
Promise.reject('err'),
]);
const statuses = settled.map(s => s.status).join(',');
let anyResult;
try {
await Promise.any([Promise.reject('a'), Promise.reject('b')]);
} catch (err) {
anyResult = `${err.name}:${err.errors.join(',')}`;
}
console.log(statuses, anyResult);
}
main();CHALLENGE
const output = [];
output.push(typeof foo);
try {
output.push(typeof bar);
} catch (e) {
output.push(e.message);
}
var foo = () => 'foo';
let bar = () => 'bar';
console.log(output.join(' | '));
CHALLENGE
const arr = [1, [2, 3], [4, [5, 6]]];
const a = arr.flat();
const b = arr.flat(Infinity);
const c = arr.flatMap(x => Array.isArray(x) ? x : [x, x]);
console.log(a, b, c);
❤1
What is the output?
Anonymous Quiz
20%
[ 1, 2, 3, 4, [ 5, 6 ] ] [ 1, 2, 3, 4, 5, 6 ] [ [1,1], [2,3], [4,[5,6]] ]
43%
[ 1, 2, 3, 4, [ 5, 6 ] ] [ 1, 2, 3, 4, 5, 6 ] [ 1, 1, 2, 3, 4, [ 5, 6 ] ]
20%
[ 1, 2, 3, 4, [ 5, 6 ] ] [ 1, 2, 3, 4, 5, 6 ] [ 1, 2, 3, 4, [ 5, 6 ] ]
17%
[ 1, 2, 3, 4, 5, 6 ] [ 1, 2, 3, 4, 5, 6 ] [ 1, 1, 2, 3, 4, [ 5, 6 ] ]