CHALLENGE
class DataProcessor {
static #cache = new Map();
static #initialized = false;
static {
console.log('First block');
this.#cache.set('default', 'value1');
}
static {
console.log('Second block');
this.#cache.set('config', 'value2');
this.#initialized = true;
}
static getStatus() {
return `${this.#cache.size}-${this.#initialized}`;
}
}
console.log(DataProcessor.getStatus());๐4โค3
What is the output?
Anonymous Quiz
25%
Second block First block 2-true
28%
First block Second block 2-false
16%
2-true First block Second block
31%
First block Second block 2-true
๐3โค1
LibPDF bills itself as โthe PDF library TypeScript deservesโ and supports parsing, modifying, signing and generating PDFs with a modern API in Node, Bun, and the browser. GitHub repo.
Documenso
Please open Telegram to view this post
VIEW IN TELEGRAM
๐10โค9๐ฅ4
CHALLENGE
const obj1 = { a: 1, b: { c: 2 } };
const obj2 = { ...obj1 };
const obj3 = obj1;
obj2.a = 10;
obj2.b.c = 20;
obj3.b.c = 30;
console.log(obj1.a);
console.log(obj1.b.c);
console.log(obj2.a);
console.log(obj2.b.c);
console.log(obj3.a);
console.log(obj3.b.c);โค5๐1๐ฅ1
What is the output?
Anonymous Quiz
37%
1 30 10 30 1 30
26%
1 20 10 20 1 20
24%
1 2 10 20 1 2
13%
10 20 10 20 10 20
โค5๐ฅ3๐1
The results of the popular annual JavaScript survey are out, and weโre focusing on the most relevant bit to Node.js: backend frameworks. Express still leads the way, but NestJS continues to grow rapidly. Meanwhile, Hono comes top in developer satisfaction.
Devographics
Please open Telegram to view this post
VIEW IN TELEGRAM
โค5๐4๐ฅ3
CHALLENGE
function memoize(fn) {
const cache = new Map();
return function(...args) {
const key = JSON.stringify(args);
if (cache.has(key)) {
return cache.get(key);
}
const result = fn.apply(this, args);
cache.set(key, result);
return result;
};
}
const fibonacci = memoize(function(n) {
if (n <= 1) return n;
return fibonacci(n - 1) + fibonacci(n - 2);
});
console.log(fibonacci(10));
console.log(fibonacci.cache?.size || 'undefined');๐ฅ5๐3โค1
โค2๐2๐ฅ2
Have you ever wondered how systems are designed to ensure reliable event delivery and processing? How can we minimise event loss to a very low level: or even achieve near-zero message loss and highly reliable processing?
nairihar
Please open Telegram to view this post
VIEW IN TELEGRAM
๐ฅ9โค6๐3
CHALLENGE
console.log('1');
setTimeout(() => console.log('2'), 0);
Promise.resolve().then(() => console.log('3'));
console.log('4');
Promise.resolve().then(() => {
console.log('5');
setTimeout(() => console.log('6'), 0);
});
console.log('7');โค1๐1๐ฅ1
What is the output?
Anonymous Quiz
17%
1 4 7 5 3 6 2
28%
1 7 4 3 5 2 6
37%
1 4 7 3 5 2 6
18%
1 4 7 2 3 5 6
โค12๐คฃ3
TypeScript 6.0 is now in beta. It's a "clean up your tsconfig" release, not meant to wow but to make sense as a bridge to the eventual Go-powered 'native' TypeScript 7 compiler.
Please open Telegram to view this post
VIEW IN TELEGRAM
โค5๐4๐ฅ3
Transformers.js brings Hugging Faceโs transformer models directly to the JavaScript world, meaning you can run numerous NLP, vision, and audio models right from Node.js. v4 is WebGPU powered and is now installable with npm.
Hugging Face
Please open Telegram to view this post
VIEW IN TELEGRAM
๐5๐ฅ5โค2
CHALLENGE
const operations = {
value: 10,
multiply: function(x) {
return this.value * x;
},
arrow: (x) => {
return this.value * x;
},
nested: function() {
const inner = () => this.value * 2;
return inner();
}
};
console.log(operations.multiply(3));
console.log(operations.arrow(3));
console.log(operations.nested());๐6๐ฅ4
โค2๐ฅ2
CHALLENGE
class Calculator {
constructor(value) {
this.value = value;
}
add(num) {
this.value += num;
return this;
}
getValue = () => this.value;
}
const calc = new Calculator(10);
const addMethod = calc.add;
const getValueMethod = calc.getValue;
addMethod.call({value: 5}, 3);
console.log(calc.getValue());
console.log(getValueMethod());โค5๐2๐ฅ2๐คฉ2
๐3โค2
A smooth, fast way to browse packages on the official npm registry. Itโs certainly fast, smooth, and you see more info up front and center - check out the axios page for example. โWeโre not replacing the npm registry, but instead providing an elevated developer experience through a fast, modern UI.โ
npmx
Please open Telegram to view this post
VIEW IN TELEGRAM
๐ฅ5โค2๐2๐คฃ1
CHALLENGE
const wm = new WeakMap();
const obj1 = { name: 'Sarah' };
const obj2 = { name: 'Mike' };
wm.set(obj1, 'developer');
wm.set(obj2, 'designer');
console.log(wm.get(obj1));
console.log(wm.has(obj2));
console.log(wm.get({ name: 'Sarah' }));
console.log(wm.delete(obj1));
console.log(wm.has(obj1));
โค4๐ฅ2๐1