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 #2860 · Back to latest

Older Posts 20 shown
Post #2859 4.09K
  • 🔥 5
  • ❤ 3
  • 👍 3
Post #2858 4.02K
CHALLENGE

const x = null;
const y = undefined;
const z = 0;

const result1 = x ?? 'default';
const result2 = y ?? 'default';
const result3 = z ?? 'default';

const combined = result1 ? result2 ? result3 : 'B' : 'C';

console.log(combined);
  • ❤ 3
  • 🔥 2
  • 👍 1
Post #2857 4.17K
🤔 Open Sourcing the Remix Store

The Remix Store is a swag store for the Remix project and its codebase provides a powerful example of how Remix’s own core team builds apps with Remix and Hydrogen.

Brooks Lybrand and the Remix Team
  • ❤ 6
  • 👍 2
  • 🔥 2
Post #2855 4.02K
CHALLENGE

function Vehicle(type) {
this.type = type;
}

Vehicle.prototype.wheels = 4;
Vehicle.prototype.getInfo = function() {
return `${this.type}: ${this.wheels}`;
};

const car = new Vehicle('Car');
const bike = Object.create(car);
bike.type = 'Bike';
bike.wheels = 2;

console.log(car.getInfo() + ' | ' + bike.getInfo());
  • ❤ 10
Post #2853 4.11K
👀 Useful Patterns for Building HTML Tools

In many situations, you don’t need a full-on framework to build useful tools; just HTML, JavaScript and CSS in a single file will do the job fine. Simon’s become a bit of an expert by rolling out many such tools using LLMs, and shares his process and practices here. More please!

Simon Willison
  • ❤ 8
  • 👍 3
Post #2852 3.97K
  • 👍 6
  • ❤ 2
Post #2851 4.05K
CHALLENGE

const obj = { a: 1, b: 2, c: 3 };
Object.defineProperty(obj, 'd', {
value: 4,
enumerable: false
});

const entries = Object.entries(obj);
const keys = Object.keys(obj);
const values = Object.values(obj);

console.log(entries.length + keys.length + values.length);
  • ❤ 9
  • 🤩 2
  • 👍 1
Post #2850 4.14K
👀 Many Devs blame Vercel for Next.js-related React security vulnerabilities.

Because making new frameworks like Next.js is relatively easy nowadays, someone with enough social influence can literally destroy Vercel's business by popularising some other framework, which, by the way, would have nearly identical problems anyway, because this was mostly the React problem itself.

Tigran Bayburtsyan
  • ❤ 7
  • 🤔 2
Post #2849 3.75K
  • 👍 5
  • ❤ 3
  • 🤩 1
Post #2848 3.8K
CHALLENGE

class Subject {
constructor() {
this.observers = [];
}
attach(observer) {
this.observers.push(observer);
}
notify(data) {
this.observers.forEach(obs => obs.update(data));
}
}

const subject = new Subject();
subject.attach({ update: (d) => console.log(d * 2) });
subject.attach({ update: (d) => console.log(d + 5) });
subject.notify(10);
  • ❤ 3
Post #2847 3.97K
⚠️ 🔵 Denial of Service and Source Code Exposure in React Server Components

Security researchers have found and disclosed two additional vulnerabilities in React Server Components while attempting to exploit the patches in last week’s critical vulnerability.

If you already updated for the Critical Security Vulnerability last week, you will need to update again.

If you updated to 19.0.2, 19.1.3, and 19.2.2, these are incomplete and you will need to update again.

December 11, 2025 by The React Team
  • 👍 5
  • ❤ 2
  • 🤔 2
Post #2846 3.44K
  • ❤ 7
  • 👍 4
Post #2845 3.65K
CHALLENGE

const a = { x: 1 };
const b = a;
const c = { x: 1 };

b.x = 2;
const d = b;
d.x = 3;

console.log(a.x);
console.log(b.x);
console.log(c.x);
console.log(a === b);
console.log(a === c);
  • ❤ 4
Post #2844 3.89K
  • 👍 5
  • ❤ 2
Post #2843 3.74K
CHALLENGE

const curry = (fn) => {
return function curried(...args) {
if (args.length >= fn.length) {
return fn.apply(this, args);
}
return (...nextArgs) => curried(...args, ...nextArgs);
};
};

const multiply = (a, b, c) => a * b * c;
const curriedMultiply = curry(multiply);

const step1 = curriedMultiply(2);
const step2 = step1(3);
const result = step2(4);

console.log(result);
  • ❤ 1
  • 👍 1
Post #2842 3.97K
  • ❤ 10
  • 👍 2
Post #2841 4.15K
CHALLENGE

const x = 5;
const y = 10;

const obj = {
x,
y,
z: x + y,
calculate() {
return this.x * this.y;
},
[x + y]: 'computed'
};

console.log(obj.calculate() + obj[15] + obj.z);
  • ❤ 4
  • 👍 1
Post #2840 3.59K
  • ❤ 5
  • 👍 3
  • 🤔 3
  • 🤩 3
Post #2839 3.75K
CHALLENGE

const promise1 = Promise.resolve(10);
const promise2 = promise1.then(x => x * 2);
const promise3 = promise2.then(x => {
console.log(x);
return x + 5;
});
const promise4 = promise2.then(x => {
console.log(x);
return x * 3;
});
Promise.all([promise3, promise4]).then(results => {
console.log(results);
});
  • ❤ 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 →