What is the output?
Anonymous Quiz
20%
undefined
45%
Age must be a number Property 'job' doesn't exist
19%
Age must be a number
16%
Property 'job' doesn't exist
π3β€2π₯2
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£45π12β€2π₯1π€1
CHALLENGE
function executePromises() {
console.log(1);
setTimeout(() => {
console.log(2);
}, 0);
Promise.resolve().then(() => {
console.log(3);
setTimeout(() => {
console.log(4);
}, 0);
}).then(() => {
console.log(5);
});
console.log(6);
}
executePromises();
π₯3β€2π1
What is the output?
Anonymous Quiz
23%
1, 6, 3, 2, 5, 4
25%
1, 6, 2, 3, 5, 4
24%
1, 3, 5, 6, 2, 4
28%
1, 6, 3, 5, 2, 4
π6π€©5β€2π₯1
Several years in the making, the record and tuples proposal offered two new deeply immutable data structures to JavaScript, but at this weekβs TC39 meeting, the consensus was to drop it.
Please open Telegram to view this post
VIEW IN TELEGRAM
π7π€4π€£3β€2π₯1
CHALLENGE
function main() {
console.log(1);
setTimeout(() => console.log(2), 0);
Promise.resolve().then(() => {
console.log(3);
setTimeout(() => console.log(4), 0);
}).then(() => console.log(5));
Promise.resolve().then(() => console.log(6));
console.log(7);
}
main();
β€5π2
What is the output?
Anonymous Quiz
25%
1, 3, 5, 6, 7, 2, 4
37%
1, 7, 3, 6, 5, 2, 4
15%
1, 7, 6, 3, 5, 2, 4
22%
1, 7, 3, 5, 6, 2, 4
π6π₯3β€2
Even if you donβt want to render a neat plasma-style effect on the Web, this is a wonderfully deep exploration of the math and technology behind doing so using simple GLSL code that could be easily understood by any JavaScript developer.
Alex Harri
Please open Telegram to view this post
VIEW IN TELEGRAM
β€3π2π€£2
CHALLENGE
const team = {
members: ['Alice', 'Bob', 'Charlie'],
[Symbol.iterator]: function*() {
let index = 0;
while(index < this.members.length) {
yield this.members[index++].toUpperCase();
}
}
};
const result = [];
for (const member of team) {
result.push(member);
}
console.log(result.join('-'));
π4
What is the output?
Anonymous Quiz
30%
Alice-Bob-Charlie
19%
TypeError: team is not iterable
46%
ALICE-BOB-CHARLIE
5%
[object Object]
π9β€2π₯2
CHALLENGE
const user = {
profile: {
name: 'Alice',
settings: {
notifications: {
email: true,
sms: false
}
}
},
getPreference(type) {
return this.profile?.settings?.notifications?.[type] ?? 'not configured';
}
};
const admin = {
profile: {
name: 'Admin',
settings: null
},
getPreference: user.getPreference
};
console.log(admin.getPreference('email'));
π4β€2
What is the output?
Anonymous Quiz
36%
not configured
33%
true
22%
TypeError: Cannot read properties of null (reading 'notifications')
10%
undefined
π€10π9β€1
Please open Telegram to view this post
VIEW IN TELEGRAM
π6β€5π₯2
CHALLENGE
const companies = [
{ name: 'TechCorp', founded: 2010 },
{ name: 'DataSystems', founded: 2015 },
{ name: 'WebSolutions', founded: 2008 }
];
const activeClients = new WeakSet();
activeClients.add(companies[0]);
activeClients.add(companies[2]);
companies.pop();
const result = [
activeClients.has(companies[0]),
activeClients.has(companies[1]),
typeof activeClients.size
];
console.log(result);
β€4π1π€1
What is the output?
Anonymous Quiz
40%
[true, false, 'number']
26%
[true, true, 'undefined']
28%
[true, false, 'undefined']
5%
[false, true, 'undefined']
β€2π€2
CHALLENGE
function processConfig(config) {
const defaults = {
timeout: 1000,
retries: 3,
enabled: false,
count: 0
};
const settings = {
...defaults,
...config
};
const effectiveTimeout = settings.timeout ?? 500;
const effectiveRetries = settings.retries ?? 1;
const effectiveEnabled = settings.enabled ?? true;
const effectiveCount = settings.count ?? 5;
console.log([effectiveTimeout, effectiveRetries, effectiveEnabled, effectiveCount]);
}
processConfig({ timeout: null, retries: 0, enabled: undefined });
π5π€1
What is the output?
Anonymous Quiz
20%
[null, 0, true, 0]
43%
[500, 0, true, 0]
29%
[500, 1, true, 5]
8%
[null, 0, true, 5]
π₯7β€5π1π€1
Please open Telegram to view this post
VIEW IN TELEGRAM
π5π₯3β€2