CHALLENGE
const user = {
profile: {
settings: {
theme: 'dark',
notifications: null
}
}
};
const result1 = user?.profile?.settings?.theme;
const result2 = user?.profile?.settings?.notifications?.email;
const result3 = user?.profile?.preferences?.language ?? 'en';
const result4 = user?.profile?.settings?.notifications?.push?.('test');
console.log(result1, result2, result3, result4);π€3
What is the output?
Anonymous Quiz
43%
dark undefined en undefined
27%
dark undefined en null
17%
undefined undefined en undefined
13%
dark null en undefined
π€3
Examples of many common algorithms (e.g. bit manipulation, Pascalβs triangle, Hamming distance) and data structures (e.g. linked lists, tries, graphs) with explanations. Available in eighteen other written languages too.
Oleksii Trekhleb et al.
Please open Telegram to view this post
VIEW IN TELEGRAM
β€8
CHALLENGE
const original = {
name: 'Sarah',
hobbies: ['reading', 'coding'],
address: { city: 'Portland', zip: 97201 }
};
const shallow = { ...original };
const deep = JSON.parse(JSON.stringify(original));
shallow.name = 'Emma';
shallow.hobbies.push('hiking');
shallow.address.city = 'Seattle';
deep.hobbies.push('swimming');
deep.address.zip = 98101;
console.log(original.hobbies.length, original.address.city);β€7π€1
β€2
Esteemed browser and Web standards expert Alex Russell looks at the state of client-side Web performance, what sort of bandwidth you should be taking into account, what devices people are using, and warns against ever-growing JavaScript bundle sizes. A lot of data here.
Alex Russell
Please open Telegram to view this post
VIEW IN TELEGRAM
β€1π1
CHALLENGE
class SimpleObservable {
constructor(subscribeFn) {
this.subscribeFn = subscribeFn;
}
subscribe(observer) {
return this.subscribeFn(observer);
}
}
const obs = new SimpleObservable(observer => {
observer.next('first');
observer.next('second');
observer.complete();
});
const results = [];
obs.subscribe({
next: val => results.push(val),
complete: () => results.push('done')
});
console.log(results.join('-'));β€2
What is the output?
Anonymous Quiz
48%
first-second-done
42%
first-second-complete
9%
first-done-second
1%
done-first-second