Please open Telegram to view this post
VIEW IN TELEGRAM
β€4π3π₯1π€1
The Google team has gone all out with this significant release of its popular JavaScript framework. Theyβve put together a retro game-themed adventure-based tour of whatβs new, along with top notch videos showing off features like its new signal-based approach to forms, MCP server for AI-powered workflows, library of headless components focused on accessibility, and even a new βAngular AI Tutorβ to get up to speed.
Please open Telegram to view this post
VIEW IN TELEGRAM
π6β€3π€3
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);π€5
What is the output?
Anonymous Quiz
41%
dark undefined en undefined
27%
dark undefined en null
17%
undefined undefined en undefined
14%
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
β€10
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
π5β€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('-'));β€4π1π€1
What is the output?
Anonymous Quiz
48%
first-second-done
37%
first-second-complete
12%
first-done-second
4%
done-first-second
Get a Google Calendar-style experience in your own apps. Has connectors for React, Vue and Angular, but can be used with plain JavaScript too. The base version is MIT licensed, but thereβs a commercial version too with extra features.
Adam Shaw
Please open Telegram to view this post
VIEW IN TELEGRAM
β€10π€©1
CHALLENGE
const arr = [1, 2, 3];
const obj = { valueOf: () => 4, toString: () => '5' };
const result1 = arr + obj;
const result2 = +obj;
const result3 = String(obj);
const result4 = obj == 4;
const result5 = obj === 4;
console.log(`${result1}|${result2}|${result3}|${result4}|${result5}`);
const weird = [] + [] + 'hello';
const weirder = [] + {} + [];
const weirdest = {} + [] + {};
console.log(`${weird}|${weirder}|${weirdest}`);
const final = !!'0' + !!'' + !!null + !!undefined;
console.log(final);
β€1
β€4π€1
Draft diagrams quickly with TypeScript. Define your data models through top-level type aliases and interfaces and it automatically lays out the nodes in an efficient way. GitHub repo.
Andrei Neculaesei
Please open Telegram to view this post
VIEW IN TELEGRAM
β€9π2
CHALLENGE
const data = '{"users": [{"name": "Sarah", "age": 25}, {"name": "Mike", "age": null}]}';
try {
const parsed = JSON.parse(data);
const result = parsed.users.map(user => {
return user.age ?? 'unknown';
});
console.log(result.join(' - '));
} catch (error) {
console.log('Parse error occurred');
}
const invalidJson = '{"name": "John", age: 30}';
try {
JSON.parse(invalidJson);
console.log('Success');
} catch {
console.log('Invalid');
}β€10
What is the output?
Anonymous Quiz
28%
Parse error occurred, Invalid
38%
25 - null, Success
10%
25 - unknown
25%
25 - unknown, Invalid
π8β€2π€2
CHALLENGE
class Logger {
log(msg) {
return `[LOG]: ${msg}`;
}
}
class Formatter {
format(text) {
return text.toUpperCase();
}
}
class Service {
constructor(logger, formatter) {
this.logger = logger;
this.formatter = formatter;
}
process(data) {
const formatted = this.formatter.format(data);
return this.logger.log(formatted);
}
}
const service = new Service(new Logger(), new Formatter());
console.log(service.process('hello world'));β€4π3π€2
What is the output?
Anonymous Quiz
48%
[LOG]: HELLO WORLD
30%
HELLO WORLD
15%
hello world
8%
[LOG]: hello world
β€2π1
CHALLENGE
let obj1 = { name: 'Sarah' };
let obj2 = { name: 'Mike' };
obj1.ref = obj2;
obj2.ref = obj1;
let weakRef = new WeakRef(obj1);
let registry = new FinalizationRegistry((value) => {
console.log(`Cleanup: ${value}`);
});
registry.register(obj1, 'obj1-cleaned');
obj1 = null;
obj2 = null;
console.log(weakRef.deref()?.name || 'undefined');
console.log('Script completed');What is the output?
Anonymous Quiz
29%
Sarah Script completed
41%
undefined Script completed Cleanup: obj1-cleaned
20%
Sarah Script completed Cleanup: obj1-cleaned
9%
undefined Script completed
π₯4π€4β€1