CHALLENGE
console.log('1');
setTimeout(() => console.log('2'), 0);
Promise.resolve().then(() => console.log('3'));
queueMicrotask(() => console.log('4'));
setTimeout(() => console.log('5'), 0);
Promise.resolve().then(() => {
console.log('6');
return Promise.resolve();
}).then(() => console.log('7'));
console.log('8');
❤6🔥3👍1
What is the output?
Anonymous Quiz
39%
1 8 3 4 6 7 2 5
29%
1 8 4 3 6 2 7 5
16%
1 8 3 6 4 7 2 5
16%
1 2 3 4 5 6 7 8
A project originally spawned from the BBC’s R&D department, Peaks renders audio waveforms to a canvas element and allows scrolling, zooming, and the sort of things you might otherwise see in an audio editor. LGPL licensed.
Chris Needham et al.
Please open Telegram to view this post
VIEW IN TELEGRAM
❤3👍2🔥2
CHALLENGE
class CustomError extends Error {
constructor(message) {
super(message);
this.name = 'CustomError';
}
}
try {
try {
throw new CustomError('inner error');
} catch (e) {
console.log(e.name);
throw new Error('outer error');
}
} catch (e) {
console.log(e.message);
console.log(e instanceof CustomError);
}
❤1
What is the output?
Anonymous Quiz
43%
CustomError outer error false
33%
CustomError inner error true
17%
Error outer error false
7%
CustomError outer error true
❤3🔥1
🎨 Eyecons is a VS Code icon theme that automatically adapts the color of icons to fit your editor's main theme – well, from this list anyway.
👍7❤1🔥1
CHALLENGE
const original = {
name: 'Sarah',
scores: [85, 92, 78],
details: {
age: 25,
city: 'Portland'
}
};
const copy1 = { ...original };
const copy2 = JSON.parse(JSON.stringify(original));
copy1.name = 'Emma';
copy1.scores.push(95);
copy1.details.age = 30;
console.log(original.name, original.scores.length, original.details.age);
❤2🔥2
❤4