Use this command (insert your preferred tool)
Please open Telegram to view this post
VIEW IN TELEGRAM
β€6π2π₯2
CHALLENGE
function highlight(strings, ...values) {
return strings.reduce((result, string, i) => {
const value = values[i] ? `<mark>${values[i]}</mark>` : '';
return result + string + value;
}, '');
}
const name = 'Sarah';
const age = 25;
const template = highlight`Hello ${name}, you are ${age} years old!`;
console.log(template);
const empty = highlight`No interpolation here`;
console.log(empty);
1β€8
CHALLENGE
class EventManager {
constructor() {
this.listeners = new Map();
}
addListener(event, callback) {
if (!this.listeners.has(event)) {
this.listeners.set(event, new Set());
}
this.listeners.get(event).add(callback);
}
removeListener(event, callback) {
this.listeners.get(event)?.delete(callback);
}
}
const manager = new EventManager();
const handler = () => console.log('handled');
manager.addListener('click', handler);
manager.removeListener('click', () => console.log('handled'));
console.log(manager.listeners.get('click').size);
What is the output?
Anonymous Quiz
19%
0
39%
TypeError: Cannot read properties of undefined of 'size'
33%
1
9%
undefined
β€3π3π₯1
Supporting both browsers and Node.js, this library lets you read, write and convert popular media file formats (e.g. MP4, MP3, and more) without needing to lean on dependencies like FFmpeg. You can make thumbnails, extract metadata, write code that gets converted into a video, and more. GitHub repo.
Vanilagy
Please open Telegram to view this post
VIEW IN TELEGRAM
1β€5π₯3π2
CHALLENGE
const data = { a: 1, b: 2, c: 3 };
const { a, ...rest } = data;
const newObj = { ...rest, a, d: 4 };
const arr = [1, 2, 3, 4, 5];
const [first, , third, ...remaining] = arr;
const result = [...remaining, third, first];
console.log(newObj);
console.log(result);
What is the output?
Anonymous Quiz
19%
{ a: 1, b: 2, c: 3, d: 4 } [3, 1, 4, 5]
63%
{ b: 2, c: 3, a: 1, d: 4 } [4, 5, 3, 1]
12%
{ b: 2, c: 3, d: 4, a: 1 } [4, 5, 1, 3]
5%
{ a: 1, d: 4, b: 2, c: 3 } [1, 3, 4, 5]
π₯2β€1π1
A fantastic walkthrough of Chromeβs origins and its evolution over the years. Addy looks at key milestones (multi-process architecture for example), security, its steps into the world of AI, and more.
Addy Osmani
Please open Telegram to view this post
VIEW IN TELEGRAM
1β€5π2π€©2π₯1