JavaScript – Telegram
JavaScript
33.7K subscribers
1.11K photos
10 videos
33 files
789 links
A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javanoscript 🚀 Don't miss our Quizzes!

Let's chat: @nairihar
Download Telegram
What is the output?
Anonymous Quiz
31%
89 5 89
42%
55 5 55
11%
55 5 21
17%
55 8 55
2👍1🔥1
⁉️ How Not to Parse Numbers in JavaScript

Why use a proper locale-aware API to parse numbers when you can hand-roll a maze of string splits, separator swaps, and implicit type coercions that silently break on edge cases?

Remy Porter (The Daily WTF)
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥72👍1
CHALLENGE

let counter = 0;

const increment = () => ++counter;
const getValue = () => counter;

const obj = {
get value() {
increment();
return getValue();
}
};

console.log(obj.value);
console.log(obj.value);
console.log(counter);
6🔥3👍1
What is the output?
Anonymous Quiz
24%
1 1 1
23%
2 4 4
18%
0 1 2
35%
1 2 2
2👍2🔥1
👀 Heat.js 5.0: A Flexible Heat Map Rendering Solution

Generate customized interactive heatmaps (think GitHub contributions graph), or render heatmaps as lines and bar charts. The site is packed with demos to enjoy. GitHub repo.

William Troup
Please open Telegram to view this post
VIEW IN TELEGRAM
8🔥5👍3
CHALLENGE

const target = { name: "Sarah", age: 25 };

const handler = {
get(obj, prop) {
if (prop === 'greeting') {
return `Hello, I'm ${obj.name}`;
}
return obj[prop]?.toString().toUpperCase() || 'UNKNOWN';
},

set(obj, prop, value) {
if (typeof value === 'string') {
obj[prop] = value.toLowerCase();
} else {
obj[prop] = value * 2;
}
return true;
}
};

const proxy = new Proxy(target, handler);
console.log(proxy.name);
proxy.city = "Boston";
proxy.score = 15;
console.log(proxy.greeting);
console.log(proxy.city + " " + proxy.score);
👍123🔥3
🌪 GitHub is exploring solutions to tackle low-quality contributions, which could include giving you the option to disable PRs entirely or at least restrict them to collaborators. Got opinions? Join the discussion.
Please open Telegram to view this post
VIEW IN TELEGRAM
5👍4🔥3
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());
1👍1
👀 Introducing LibPDF: PDF Parsing and Generation from TypeScript

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
5👍4🔥1
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);
4👍1
5🔥3👍1
🌲 The State of JavaScript 2025: Backend Frameworks

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
3👍1
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');
🔥3
2👍2🔥2
🌲 An Advanced Retry Mechanism in Node.js with Kafka

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
🔥64👍1
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');
6🤣2
🥶🌲 TypeScript 6.0 enters beta, but what does it mean for Node developers?

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
4👍2🔥1