What is the output?
Anonymous Quiz
29%
54 CAUGHT: TOO LARGE: 26
29%
CAUGHT: TOO LARGE: 26 18
35%
18 CAUGHT: TOO LARGE: 26
7%
18 Caught: Too large: 26
๐ฅ2โค1
The Temporal API, designed to modernize JavaScriptโs date/time handling, reached stage 4 last month. Node was waiting on V8 to make it enabled by default, which happened in V8 14.4, and the wheels are now in motion for an eventual release in Node 26.
Richard Lau
Please open Telegram to view this post
VIEW IN TELEGRAM
โค7๐7๐ฅ1
CHALLENGE
const handler = {
get(target, prop, receiver) {
if (prop in target) {
return Reflect.get(target, prop, receiver) * 2;
}
return `${prop} not found`;
},
set(target, prop, value) {
if (typeof value !== "number") {
throw new TypeError("Only numbers allowed");
}
target[prop] = value + 10;
return true;
},
has(target, prop) {
return prop.startsWith("x") ? false : prop in target;
},
};
const obj = new Proxy({ score: 5, xp: 100 }, handler);
obj.level = 3;
console.log(obj.score);
console.log(obj.level);
console.log("xp" in obj);
console.log("score" in obj);
console.log(obj.rank);
โค2๐1๐ฅ1
What is the output?
Anonymous Quiz
30%
10 26 true false rank not found
41%
5 13 true true undefined
17%
10 13 false true rank not found
12%
10 26 false true rank not found
๐ฅ2๐1
Please open Telegram to view this post
VIEW IN TELEGRAM
โค10๐5๐ฅ3
CHALLENGE
const curry = (fn) => {
const arity = fn.length;
return function curried(...args) {
if (args.length >= arity) {
return fn(...args);
}
return (...moreArgs) => curried(...args, ...moreArgs);
};
};
const volume = (l, w, h) => l * w * h;
const curriedVolume = curry(volume);
const withLength5 = curriedVolume(5);
const withLength5Width3 = withLength5(3);
console.log(typeof withLength5);
console.log(typeof withLength5Width3);
console.log(withLength5Width3(2));
console.log(curriedVolume(4)(6)(2));๐3๐ฅ3โค1
What is the output?
Anonymous Quiz
25%
undefined function 15 48
53%
function function 30 48
15%
function function 30 24
7%
function number 30 48
โค4๐3๐ฅ2
CHALLENGE
function checkTDZ() {
console.log(typeof undeclaredVar);
try {
console.log(typeof letVar);
} catch (e) {
console.log(`Caught: ${e.constructor.name}`);
}
let letVar = "initialized";
const result = (() => {
let x = 10;
return function () {
let x = x + 5;
return x;
};
})();
try {
console.log(result());
} catch (e) {
console.log(`Caught: ${e.constructor.name}`);
}
}
checkTDZ();
โค1๐1๐ฅ1
CHALLENGE
const str = " Hello, World! ";
const result = str
.trim()
.split(", ")
.map((word, i) => {
return i === 0
? word.toUpperCase()
: word.replace(/!$/, "").split("").reverse().join("") + "?";
})
.join(" | ");
const [first, ...rest] = result.split(" | ");
const final = `${first} | ${rest.join(" & ")}`;
console.log(final);
โค1๐ฅ1
What is the output?
Anonymous Quiz
31%
Hello | WORLD!
24%
HELLO | World?
37%
HELLO | dlroW?
8%
HELLO | dlroW!
๐3โค2
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");
๐ฅ1
โค2๐2๐ฅ1
The hugely useful MDN has rebuilt its frontend stack from the ground up, ditching React for web components and a homegrown server component system. A great read on building a modern, content-heavy site without shipping unnecessary JavaScript on every page.
Leo McArdle (MDN)
Please open Telegram to view this post
VIEW IN TELEGRAM
โค9๐ฅ2๐1
CHALLENGE
const prefix = 'user';
const id = 42;
const role = 'admin';
const capitalize = str => str.charAt(0).toUpperCase() + str.slice(1);
const profile = {
[`${prefix}_${id}`]: 'Marcus',
[Symbol.iterator]: null,
[`get${capitalize(role)}`]: () => 'full-access',
[`${prefix}Count`]: 3,
};
const dynamicKey = `${prefix}_${id}`;
console.log(
profile[dynamicKey],
profile[`get${capitalize(role)}`](),
profile[`${prefix}Count`] * id,
Object.keys(profile).length
);
โค2
What is the output?
Anonymous Quiz
26%
Marcus full-access 126 3
36%
Marcus full-access 42 3
23%
undefined full-access 126 4
15%
Marcus full-access 126 4
โค2๐ค1
One personโs entertaining and heroic tale of wielding JavaScript to explore the Firefox extension ecosystem. And what oddities there are within! I enjoyed this a lot, itโs like Alice in Wonderland for developers. More spelunking like this please.
Jack Cab
Please open Telegram to view this post
VIEW IN TELEGRAM
โค4๐ฅ4๐3๐คฃ2๐ค1๐คฉ1
CHALLENGE
const values = [0.1 + 0.2, NaN, Infinity, -0, 42.6789];
const results = values.map((v, i) => {
if (i === 0) return Number.isInteger(v) + " " + v.toFixed(1);
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) + " " + (v === 0);
if (i === 4) return v.toPrecision(4) + " " + Math.trunc(v);
});
results.forEach(r => console.log(r));
โค1๐1๐ฅ1
Snapshots your real UI and captures a flat list of skeleton โbonesโ which are positioned, sized rectangles that mirror the page exactly. Supports React, Preact, React Native, Vue, Svelte, and Angular.
0xGF
Please open Telegram to view this post
VIEW IN TELEGRAM
โค4๐4๐ค1