CHALLENGE
const target = { name: 'Sarah', age: 25 };
const handler = {
get(obj, prop) {
if (prop === 'info') {
return `${obj.name} is ${obj.age}`;
}
return Reflect.get(obj, prop);
},
has(obj, prop) {
return prop !== 'age' && Reflect.has(obj, prop);
}
};
const proxy = new Proxy(target, handler);
console.log(proxy.info);
console.log('age' in proxy);
console.log('name' in proxy);What is the output?
Anonymous Quiz
32%
Sarah is 25, true, false
44%
Sarah is 25, false, true
17%
undefined, false, true
8%
Sarah is 25, false, false
β€3π€2π1
Originally built by JP Morgan, this data visualization component, built in C++ and compiled to WebAssembly, is well-suited for large and real-time streaming datasets. The demo on the homepage lets you try visualization types at up to 1000 changes per second. v4.0 sees the project move to the OpenJS Foundation.
OpenJS Foundation
Please open Telegram to view this post
VIEW IN TELEGRAM
β€1π1
CHALLENGE
console.log('1');
setTimeout(() => console.log('2'), 0);
Promise.resolve().then(() => console.log('3'));
queueMicrotask(() => console.log('4'));
setTimeout(() => {
console.log('5');
Promise.resolve().then(() => console.log('6'));
}, 0);
console.log('7');β€1
What is the output?
Anonymous Quiz
35%
1 7 3 4 2 5 6
28%
1 7 3 4 5 2 6
22%
1 7 2 3 4 5 6
15%
1 3 4 7 2 5 6
β€6π1π₯1
Please open Telegram to view this post
VIEW IN TELEGRAM
π₯6
CHALLENGE
const target = { name: 'Sarah', age: 25 };
const handler = {
get(obj, prop) {
if (prop in obj) {
return obj[prop];
}
return `Property '${prop}' not found`;
},
set(obj, prop, value) {
obj[prop] = value.toString().toUpperCase();
return true;
}
};
const proxy = new Proxy(target, handler);
proxy.city = 'boston';
console.log(proxy.name);
console.log(proxy.city);
console.log(proxy.country);What is the output?
Anonymous Quiz
15%
Sarah boston undefined
45%
Sarah boston Property 'country' not found
33%
Sarah BOSTON Property 'country' not found
6%
Sarah BOSTON undefined
β€3π₯2
CHALLENGE
const Flyable = {
fly() { return 'flying'; }
};
const Swimmable = {
swim() { return 'swimming'; }
};
function applyMixins(target, ...mixins) {
mixins.forEach(mixin => {
Object.assign(target.prototype, mixin);
});
}
class Bird {}
class Fish {}
applyMixins(Bird, Flyable, Swimmable);
applyMixins(Fish, Swimmable);
const eagle = new Bird();
const shark = new Fish();
console.log(eagle.swim());
console.log(shark.fly?.() || 'undefined method');β€2π₯1
What is the output?
Anonymous Quiz
50%
swimming undefined method
20%
flying swimming
16%
undefined method swimming
15%
swimming flying
β€4π€3π1π€£1
Iβm a sucker for a big table of data and this is about as big as it gets when it comes to JavaScript engines. See how various engines compare, sort them by performance, or click on an engineβs name to learn more about its development, history, and end users. The projectβs repo also has Dockerfiles for trying each of them out.
Ivan Krasilnikov
Please open Telegram to view this post
VIEW IN TELEGRAM
β€6π3
- Iterator Sequencing progressed to stage 4.
- Joint Iteration, Iterator Join, and Await dictionary of Promises go stage 2.7.
- The Intl Unit Protocol also reached stage 1 to provide a way to annotate quantities with the units being measured.
- Typed Array Find Within progressed to stage 1. Think a native indexOf-type method for TypedArrays.
Note: Learn more about what the TC39 stages mean here.
Please open Telegram to view this post
VIEW IN TELEGRAM
β€4π2π₯2