TGViewer
Channel Public Channel
JavaScript

JavaScript

@javascript

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
Subscribers
31.1K
Photos
1.2K
Videos
10
Links
895

Showing posts older than #3004 · Back to latest

Older Posts 20 shown
Post #3002 3.17K
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
Post #3001 3.2K
😮 npmx: A New npm Registry Package Browser

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
  • 🔥 5
  • ❤ 2
  • 👍 2
  • 🤣 1
Post #3000 3.13K
  • 👍 3
  • ❤ 2
Post #2999 3.2K
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());
  • ❤ 6
  • 👍 3
  • 🔥 2
  • 🤩 2
Post #2998 2.98K
🤩 broz (above) is a simple Node/Electron tool you can use via npx if you're tired of fidgeting around to get a screenshot of a site with a clean look. From the maintainer of Shiki.
  • 🔥 6
  • ❤ 5
  • 👍 3
Post #2997 3.4K
  • ❤ 2
  • 🔥 2
Post #2996 3.3K
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
  • 🔥 5
Post #2995 3.38K
👀 Transformers.js v4 Preview Released

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
  • 👍 5
  • 🔥 5
  • ❤ 3
Post #2992 3.62K
  • ❤ 12
  • 🤣 4
Post #2991 3.55K
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
Post #2990 3.72K
🌲 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
  • 🔥 9
  • ❤ 6
  • 👍 3
Post #2989 3.42K
  • ❤ 2
  • 👍 2
  • 🔥 2
Post #2988 3.62K
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
Post #2987 3.37K
🌲 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
  • ❤ 5
  • 👍 4
  • 🔥 3
Post #2986 3.55K
  • ❤ 5
  • 🔥 3
  • 👍 1
Post #2985 3.56K
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
Post #2983 3.86K
  • 👍 3
  • ❤ 1
Older posts →
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →