CHALLENGE
const p1 = new Promise((resolve) => {
console.log("A");
resolve("B");
});
const p2 = p1.then((val) => {
console.log(val);
return "C";
});
p2.then((val) => {
console.log(val);
});
console.log("D");
ð¥5â€2ð1
â€3ð¥1
CHALLENGE
function highlight(strings, ...values) {
return strings.reduce((result, str, i) => {
const value = values[i - 1];
const transformed =
typeof value === "number"
? `[${value * 2}]`
: `(${String(value).toUpperCase()})`;
return result + transformed + str;
});
}
const product = "widget";
const qty = 4;
const price = 12.5;
const output = highlight`Order: ${product} x${qty} @ $${price}`;
console.log(output);â€5ð2ð€£1
What is the output?
Anonymous Quiz
26%
Order: (WIDGET) x[4] @ $[25]
45%
Order: (WIDGET) x[8] @ $[25]
17%
Order: (widget) x[8] @ $[25]
12%
Order: (WIDGET) x[8] @ $[12.5]
â€3ð¥3
CHALLENGE
function* pipeline(...fns) {
let value = yield;
for (const fn of fns) {
value = yield fn(value);
}
return value;
}
const double = x => x * 2;
const addTen = x => x + 10;
const square = x => x * x;
const gen = pipeline(double, addTen, square);
gen.next(); // prime the generator
const r1 = gen.next(3);
const r2 = gen.next(r1.value);
const r3 = gen.next(r2.value);
console.log(r1.value, r2.value, r3.value);â€4ð2
ð¥3
An experienced developer built and benchmarked the same app across numerous frameworks (e.g. Angular, Solid, React, Alpine.jsâŠ). Here are the results, covering bundle size, build time, UX metrics, and more.
Alicia Sykes
Please open Telegram to view this post
VIEW IN TELEGRAM
â€2ð¥2
A Microsoft project that compiles a simple, declarative JSON-based spec of a data visualization into a form that Vega-Lite, ECharts or Chart.js can render. It's pitched at agentic use, but is a simple intermediate format humans could benefit from too.
Microsoft Research
Please open Telegram to view this post
VIEW IN TELEGRAM
â€7ð1
Famously, the only thing Java gave JavaScript was the first four letters of its name. That goes unmentioned in ð this new documentary about Java (74 minutes), but I enjoyed learning Java's story anyway. It's from the same folks as the fantastic Vite, Angular, and Node.js documentaries.
Please open Telegram to view this post
VIEW IN TELEGRAM
ð€£4ð2â€1
A dissection of a North Korean campaign that hides malware inside SVG images in a fake job interview's JavaScript 'coding challenge'. The targeting of job-seeking devs is on the increase, as Roman Imankulov recently discovered first-hand.
Daniel Stepanic (Elastic)
Please open Telegram to view this post
VIEW IN TELEGRAM
ð€£5â€3ð1
A PDF parser built in Rust with bindings for Node (plus WASM, Rust, and Python) â it worked great in my testing. It includes OCR, handles layouts/is spatially aware, and is fast (a complex 140-page PDF took ~10 seconds). Here's how to get started from Node.
LlamaIndex
Please open Telegram to view this post
VIEW IN TELEGRAM
â€5ð2
CHALLENGE
class Timer {
constructor() { this.seconds = 0; }
start() {
this.tick = () => { this.seconds++; return this.seconds; };
return this.tick;
}
}
const t = new Timer();
const tick = t.start();
const obj = { seconds: 100, tick };
console.log(tick(), obj.tick(), t.seconds);ð2ð¥1
â€3
From the creator of NodeBook, a thorough guide to Node's internals, comes a scroll-driven visualization following every step a single HTTP POST request takes from the user's click to Node's event loop and on to a database behind it.
Ishtmeet Singh
Please open Telegram to view this post
VIEW IN TELEGRAM
â€1ð1ð¥1
CHALLENGE
const primArr = [1, 2, 3];
const copyArr = [...primArr];
copyArr[0] = 99;
const objArr = [{ x: 1 }, { x: 2 }];
const copyObjArr = [...objArr];
copyObjArr[0].x = 99;
console.log(primArr[0], copyArr[0], objArr[0].x, copyObjArr[0].x);
â€2
CHALLENGE
const arr = [1, [2, 3], [4, [5, 6]], 7];
const a = arr.flat();
const b = arr.flat(2);
const c = arr.flatMap(x => Array.isArray(x) ? x : [x, x]);
const d = [1, 2, 3].flatMap(x => [[x]]);
console.log(JSON.stringify([a, b, c, d]));
What is the output?
Anonymous Quiz
21%
[[1,2,3,4,[5,6],7],[1,2,3,4,5,6,7],[1,1,2,3,4,[5,6],7,7],[1,2,3]]
38%
[[1,2,3,4,[5,6],7],[1,2,3,4,5,6,7],[1,1,2,3,4,[5,6],7,7],[[1],[2],[3]]]
33%
[[1,2,3,4,5,6,7],[1,2,3,4,5,6,7],[1,1,2,3,4,[5,6],7,7],[[1],[2],[3]]]
8%
[[1,2,3,4,[5,6],7],[1,2,3,4,5,6,7],[1,1,2,3,4,5,6,7,7],[[1],[2],[3]]]
ð1
CHALLENGE
const source = {
_val: 1,
get val() { return this._val; }
};
const copy1 = Object.assign({}, source);
source._val = 100;
const copy2 = { ...source };
copy1._val = 999;
console.log(copy1.val, copy2.val, source.val, copy1._val);â€2
What is the output?
Anonymous Quiz
23%
1 100 1 999
38%
1 100 100 999
33%
100 100 100 999
6%
1 1 100 999
â€1