CHALLENGE
const inventory = {
items: ['apple', 'banana', 'orange'],
[Symbol.iterator]: function() {
let index = 0;
const items = this.items;
return {
next: function() {
return index < items.length ?
{ value: items[index++].toUpperCase(), done: false } :
{ done: true };
}
};
}
};
const result = [...inventory].join(' + ');
console.log(result);
β€4π4π₯1
What is the output?
Anonymous Quiz
19%
apple,banana,orange
22%
apple + banana + orange
52%
APPLE + BANANA + ORANGE
7%
[object Object]
π5β€2π₯1π€©1
CHALLENGE
const obj = {};
const sym1 = Symbol('description');
const sym2 = Symbol('description');
obj[sym1] = 'Value 1';
obj[sym2] = 'Value 2';
obj.regularProp = 'Regular';
const allKeys = Object.getOwnPropertySymbols(obj).length + Object.keys(obj).length;
const comparison = sym1 === sym2;
console.log(allKeys + ',' + comparison);
β€3π3π₯1
β€4π4π₯3
CHALLENGE
const team = {
members: ['Alice', 'Bob', 'Charlie'],
leader: 'Diana',
[Symbol.iterator]: function*() {
yield this.leader;
for(const member of this.members) {
yield member;
}
}
};
let names = [];
for (const person of team) {
names.push(person);
}
console.log(names.join(', '));
β€6π2
What is the output?
Anonymous Quiz
28%
Alice, Bob, Charlie, Diana
40%
Diana, Alice, Bob, Charlie
22%
Diana, Alice, Bob, Charlie, undefined
9%
Alice, Bob, Charlie
π7π€©3β€1
CHALLENGE
function processData(data) {
try {
if (!data) {
throw new TypeError('Data is required');
}
if (data.status === 'error') {
throw new Error('Invalid status');
}
return data.value.toUpperCase();
} catch (err) {
if (err instanceof TypeError) {
return 'Type Error';
}
return err.message;
}
}
console.log(processData({ status: 'error', value: 'test' }));
β€4
What is the output?
Anonymous Quiz
19%
Type Error
53%
Invalid status
19%
TYPE ERROR
10%
TypeError: Cannot read property 'toUpperCase' of undefined
π3π₯3β€2π€£1
A full-featured, configurable load generation tool that uses the Sobek Go-powered JavaScript engine to support writing test scripts in JavaScript. v1.0 promises stability, first-class TypeScript support, and better extensibility.
Grafana Labs
Please open Telegram to view this post
VIEW IN TELEGRAM
π6π₯2β€1
CHALLENGE
const obj = {
name: 'Original',
greet() {
return function() {
console.log(`Hello, ${this.name}`);
};
},
arrowGreet() {
return () => {
console.log(`Hello, ${this.name}`);
};
}
};
const globalThis = { name: 'Global' };
const newObj = { name: 'New' };
const regularFn = obj.greet();
const arrowFn = obj.arrowGreet();
regularFn.call(newObj);
β€4π2π€©1
What is the output?
Anonymous Quiz
27%
Hello, Original
44%
Hello, New
22%
Hello, undefined
6%
Hello, Global
β€4π4π₯3
If you or your users have CSV files to import, hereβs a complete CSV importing workflow for the frontend that you can drop into your app. Basic docs.
HelloCSV
Please open Telegram to view this post
VIEW IN TELEGRAM
β€3π₯3π2
CHALLENGE
const calculator = {
value: 10,
add: function(x) {
return this.value + x;
},
multiply: function(x) {
return this.value * x;
}
};
const add5 = calculator.add;
const double = calculator.multiply.bind(calculator);
const triple = calculator.multiply.bind({value: 3});
console.log(add5(2) + double(3) + triple(4));
π2
π10β€4
Nodeβs release lines are shifting a little lately β v18 has gone EOL and now v23 gives way to v24 as the βCurrentβ release for when you need the cutting edge features. It comes with npm 11, V8 13.6 (hello
RegExp.escape
, Float16Array
, and `Error.isError`), the URLPattern API exposed by default, plus Undici 7.Node.js Team
Please open Telegram to view this post
VIEW IN TELEGRAM
π12β€1π₯1
CHALLENGE
const a = 9007199254740991n; // MAX_SAFE_INTEGER as BigInt
const b = 2n;
const c = a + b;
const result = [
a === 9007199254740991,
a + 1n === 9007199254740992n,
typeof c,
c > Number.MAX_SAFE_INTEGER,
BigInt(9007199254740992) - BigInt(9007199254740991)
];
console.log(result);
π€£4β€3π2π€2
What is the output?
Anonymous Quiz
21%
[false, true, 'object', true, 1n]
31%
[true, true, 'bigint', true, 1n]
27%
[false, true, 'bigint', true, 1n]
21%
[false, true, 'bigint', true, 1]
π7β€3π€2
CHALLENGE
const team = {
name: 'Eagles',
players: ['Smith', 'Johnson', 'Williams'],
coach: { name: 'Brown', experience: 12 },
stats: { wins: 10, losses: 6 }
};
const {
name: teamName,
players: [firstPlayer, , thirdPlayer],
coach: { name },
stats: { wins, draws = 0 }
} = team;
console.log(`${teamName}-${firstPlayer}-${thirdPlayer}-${name}-${wins}-${draws}`);
π5π€£5β€1
What is the output?
Anonymous Quiz
22%
undefined-Smith-Williams-Brown-10-0
29%
Eagles-Smith-Williams-Brown-10-undefined
38%
Eagles-Smith-Williams-Brown-10-0
10%
Eagles-Smith-undefined-Brown-10-0
β€9π3π₯2π€£2