JavaScript
31.6K subscribers
1.17K photos
10 videos
33 files
844 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
CHALLENGE

class Animal {
#sound;

constructor(name, sound) {
this.name = name;
this.#sound = sound;
}

speak() {
return `${this.name} says ${this.#sound}`;
}

static create(name, sound) {
return new this(name, sound);
}
}

class Dog extends Animal {
#tricks = [];

constructor(name) {
super(name, "woof");
}

learn(trick) {
this.#tricks.push(trick);
return this;
}

perform() {
return `${this.name} performs: ${this.#tricks.join(", ")}`;
}
}

const rex = Dog.create("Rex", "bark");
rex.learn("sit").learn("shake").learn("roll over");

console.log(rex.speak());
console.log(rex.perform());
console.log(rex instanceof Animal);
console.log(rex instanceof Dog);
๐Ÿ‘€ Windows 95 as an Electron App

A full Windows 95 experience as an app on macOS, Linux, and Windows, built upon the v86 JavaScript + WASM emulator. v5.0 is a big release as you can mount a folder from your machine into it as a Z: drive, mount ISOs as CD-ROMs, thereโ€™s a shared clipboard, and Internet access has been improved. Iโ€™m so trying to get Microsoft Encartaโ€™s Mindmaze running on thisโ€ฆ

Felix Rieseberg
Please open Telegram to view this post
VIEW IN TELEGRAM
โค8๐Ÿ”ฅ4
CHALLENGE

const user = {
profile: {
name: "Marcus",
score: 0,
nickname: null,
bio: undefined,
},
};

user.profile.nickname ??= "Anonymous";
user.profile.bio ??= "No bio provided";
user.profile.score ??= 100;
user.profile.rank ??= "Beginner";

const { name, score, nickname, bio, rank } = user.profile;
console.log(`${name} | ${score} | ${nickname} | ${bio} | ${rank}`);
โค3๐Ÿ”ฅ2
๐Ÿ˜ฎ HyperFrames: Write HTML and JavaScript to Create Videos

An open-source framework for creating and rendering videos with HTML and JavaScript. Essentially a simpler non-React alternative to Remotion. It includes a variety of built-in blocks/components for common video effects and elements, and can also composite existing video and audio clips. GitHub repo.

HeyGen
Please open Telegram to view this post
VIEW IN TELEGRAM
โค6๐Ÿ”ฅ2
CHALLENGE

const counter = (function () {
let count = 0;
const history = [];

return {
increment(step = 1) {
count += step;
history.push(count);
return this;
},
decrement(step = 1) {
count -= step;
history.push(count);
return this;
},
getHistory: () => history,
getCount: () => count,
};
})();

counter.increment(5).increment(3).decrement(2);

console.log(counter.getCount(), counter.getHistory().join(" -> "));
โค4๐Ÿ‘1
โค5๐Ÿ‘2
๐Ÿ˜‰ Evan You's State of Vue 2026 Talk

A month ago, Evan You (of Vue.js and VoidZero fame) gave his annual address. Less Vue-focused than usual (though Vapor Mode is โ€œalmost readyโ€), the talk focuses on Vite-ecosystem updates covering Vite 8, Vite+, and Void.

Evan You / Vue.js Amsterdam
Please open Telegram to view this post
VIEW IN TELEGRAM
โค5๐Ÿ‘3๐Ÿ”ฅ2
CHALLENGE


const partial = (fn, ...presetArgs) => {
return function partiallyApplied(...laterArgs) {
return fn(...presetArgs, ...laterArgs);
};
};

const calculateTax = (taxRate, discount, price) => {
const discounted = price - (price * discount) / 100;
return parseFloat((discounted + (discounted * taxRate) / 100).toFixed(2));
};

const withVAT = partial(calculateTax, 20);
const withVATandDiscount = partial(withVAT, 15);

console.log(withVAT(0, 100));
console.log(withVATandDiscount(200));
console.log(partial(calculateTax, 10, 5)(50));
๐Ÿ‘2๐Ÿ”ฅ1
โค3
๐ŸŒŸ Bun v1.3.13: Smarter Testing, Streaming Installs, and Less Memory

The Bun runtime has had a great run of releases, including last weekโ€™s v1.3.12 with built-in browser automation. Now, bun test gets numerous enhancements with --isolate, --parallel, --shard and --changed options for test env isolation, parallelization, and to run only test files affected by recent changes. The runtime now uses 5% less memory, bun install gets faster, and more.

Jarred Sumner
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ”ฅ3โค2๐Ÿ‘2
CHALLENGE

const values = [0.1 + 0.2, NaN, Infinity, -0, 42.6789];

const results = values.map((v, i) => {
if (i === 0) return v.toFixed(2);
if (i === 1) return Number.isFinite(v) + " " + Number.isNaN(v);
if (i === 2) return Number.isFinite(v) + " " + isFinite(v);
if (i === 3) return Object.is(v, 0) + " " + Object.is(v, -0);
if (i === 4) return v.toPrecision(4);
});

console.log(results.join(" | "));
โค3๐Ÿ‘2๐Ÿ”ฅ2
๐Ÿ˜ƒ Git 2.54 has been released with a couple of headline features:

โ€ข git history offers a new, easy way to edit commit messages or interactively split a commit into two.

โ€ข You can now define hooks in config files (whether in a repo, at user level, or even system level) rather than just in .git/hooks. You can also run multiple hooks for the same event in this way.
Please open Telegram to view this post
VIEW IN TELEGRAM
โค5๐Ÿ”ฅ3
CHALLENGE

async function* paginate(items, pageSize) {
for (let i = 0; i < items.length; i += pageSize) {
const page = items.slice(i, i + pageSize);
yield await Promise.resolve(page);
}
}

async function* transform(source, fn) {
for await (const chunk of source) {
yield fn(chunk);
}
}

async function run() {
const data = [10, 20, 30, 40, 50, 60];

const pages = paginate(data, 2);
const mapped = transform(pages, (page) => page.map((x) => x * 2));

const results = [];
for await (const page of mapped) {
results.push(page.reduce((a, b) => a + b, 0));
}

console.log(results);
}

run();
๐Ÿ‘3โค2๐Ÿ”ฅ1๐Ÿค”1
๐Ÿค” aube: A New Node.js Package Manager

Yes, another one! Whatโ€™s noteworthy is it comes from the developer of mise, a tool that makes managing numerous languages so much easier. aubeโ€™s selling points are raw performance and being a drop-in replacement. Its defaults are also security-focused.

Jeff Dickey
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘3โค2๐Ÿ”ฅ2
CHALLENGE


class ValidationError extends Error {
constructor(message, field) {
super(message);
this.name = "ValidationError";
this.field = field;
}
}

class NetworkError extends ValidationError {
constructor(message, field, statusCode) {
super(message, field);
this.name = "NetworkError";
this.statusCode = statusCode;
}
}

const err = new NetworkError("Not Found", "endpoint", 404);

console.log([
err instanceof NetworkError,
err instanceof ValidationError,
err instanceof Error,
err instanceof TypeError,
].join(", "));
โค3๐Ÿ‘2๐Ÿ”ฅ1