All these AI And machine learning papers and blog posts these days are crammed with mathematical notation, so how about a no dependency, TeX-based approach to rendering them? The sandbox demo page shows off how smooth it is.
Emily Eisenberg and Sophie Alpert
Please open Telegram to view this post
VIEW IN TELEGRAM
❤4👍2🔥2
CHALLENGE
const secretKey = Symbol('key');
const secretValue = 'secret';
function Store() {
this[secretKey] = secretValue;
}
Store.prototype.get = function(key) {
return this[key];
};
const store = new Store();
const revealed = store.get(secretKey);
console.log(revealed);
🔥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
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