JavaScript
32.1K subscribers
1.04K photos
10 videos
33 files
722 links
A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript 🚀 Don't miss our Quizzes!

Let's chat: @nairihar
Download Telegram
KaTeX: The Fastest Math Typesetting Library for the Web

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👍63
🌲 10 Modern Node.js Runtime Features to Start Using in 2024

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
🌲 Node is Leaking Memory? setTimeout Could Be The Reason

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
👍62🔥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);
👍42
🔥8🤔5👍42
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]());
👍71
👍75🔥3
😆
Please open Telegram to view this post
VIEW IN TELEGRAM
🤣103🤩7👍32🔥1
CHALLENGE

const func = new Function('a', 'b', 'return a + b');
console.log(func(1, 2));
👍52
What is the output?
Anonymous Quiz
47%
3
19%
undefined
18%
'a+b'
15%
Error
🤔12👍94
✌️ TC39 Meets Again and Advances Key Proposals

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🔥32
CHALLENGE

function* generator() {
yield 1;
yield* [2, 3];
yield 4;
}

const gen = generator();

const arr = Array.from(gen);
console.log(arr);
👍155
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);
👍53