π₯7π6β€3
If it ever feels like the new feature spotlight shines too much on Bun or Deno, never fear - Node has been taking huge strides forward too. Liran helps us catch up with a lot of the newest Node features.
Liran Tal
Please open Telegram to view this post
VIEW IN TELEGRAM
β€5π4π₯2
CHALLENGE
function* gen() {
yield 1;
yield 2;
yield 3;
}
async function asyncFunc() {
for (let value of gen()) {
await new Promise(res => setTimeout(res, 100));
console.log(value);
}
return 'done';
}
const result = asyncFunc();
console.log(result instanceof Promise);
β€9
π₯7π3π€£2
The folks at Sentry were running into problems with how Node handles timeouts created with setTimeout or, more specifically, problems caused by hanging on to the Timeout objects setTimeout returns..
Armin Ronacher
Please open Telegram to view this post
VIEW IN TELEGRAM
π6β€2π₯2
CHALLENGE
const handler = {
get(target, prop, receiver) {
if (prop === 'secret') {
return Reflect.get(...arguments) + ' exposed';
}
return Reflect.get(...arguments);
}
};
const secretObj = { secret: 'hidden', reveal: 'nothing' };
const proxy = new Proxy(secretObj, handler);
console.log(proxy.secret);
π4β€2
π₯8π€5π4β€2
Please open Telegram to view this post
VIEW IN TELEGRAM
β€5π4π₯4
CHALLENGE
function* generator() {
yield 1;
yield 2;
}
const gen = generator();
const sym = Symbol('unique');
gen[sym] = function() {
return this.next().value;
};
console.log(gen[sym](), gen[sym](), gen[sym]());
π7β€1
What is the output?
Anonymous Quiz
23%
undefined, undefined, undefined
27%
1, 2, 3
15%
1, 1, 1
35%
1, 2, undefined
π7β€5π₯3
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£103π€©7π3β€2π₯1
CHALLENGE
const func = new Function('a', 'b', 'return a + b');
console.log(func(1, 2));
π5β€2
π€12π9β€4
The Ecma TC39 group that pushes forward the development of ECMA/JavaScript met again this week and moved several key proposals forward, including Deferred Import Evaluation, Error.isError(), RegExp escaping, and Promise.try.
Sarah Gooding (Socket)
Please open Telegram to view this post
VIEW IN TELEGRAM
π5π₯3β€2
CHALLENGE
function* generator() {
yield 1;
yield* [2, 3];
yield 4;
}
const gen = generator();
const arr = Array.from(gen);
console.log(arr);
π15β€5
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
β€3π2π₯2
CHALLENGE
const sym1 = Symbol('sym');
const sym2 = Symbol('sym');
const obj = {
[sym1]: 'value1',
[sym2]: 'value2'
};
console.log(obj[sym1], obj[sym2], sym1 === sym2);
π5β€3
What is the output?
Anonymous Quiz
25%
value1, value1, true
15%
value1, value1, false
48%
value1, value2, false
12%
undefined, undefined, false
β€20π8π€2
A library for rendering and working with infinitely pannable canvases that contain βsmart shapesβ that you can script and give various constraints and properties. GPLv3 licensed.
Minkyu Lee
Please open Telegram to view this post
VIEW IN TELEGRAM
β€2π₯2π1