What is the output?
Anonymous Quiz
24%
"object", "object"
29%
"null", "function"
28%
"object", "function"
18%
"null", "object"
1🔥10👍4🤣4❤3
Knip finds unused files, dependencies and exports in your JavaScript and TypeScript projects. Less code and dependencies lead to improved performance, less maintenance and easier refactorings.
webpro-nl
Please open Telegram to view this post
VIEW IN TELEGRAM
👍5❤3🔥2🤔1
CHALLENGE
console.log('A');
setTimeout(() => console.log('B'), 0);
Promise.resolve()
.then(() => {
console.log('C');
return Promise.resolve();
})
.then(() => console.log('D'));
console.log('E');
❤1👍1
What is the output?
Anonymous Quiz
28%
A, C, D, E, B
32%
A, E, B, C, D
10%
A, C, E, D, B
31%
A, E, C, D, B
👍15❤4🔥2🤔2
A JavaScript port of Hugging Face’s transformers Python library that makes it possible to run natural language, vision, and audio machine learning models. v3 adds WebGPU support and now supports Node (plus Deno and Bun) as well as the browser. 1200+ models are ready to run in areas like embeddings, text generation, and speech recognition (as with whisper-small).
Hugging Face
Please open Telegram to view this post
VIEW IN TELEGRAM
❤9👍5🔥4
CHALLENGE
function memoize(fn) {
const cache = {};
return (arg) => cache[arg] ?? (cache[arg] = fn(arg));
}
const square = memoize((n) => n * n);
console.log(square(5));
console.log(square(5));
console.log(square(6));
👍6🔥1
👍8❤4🔥4
👍9🔥7🤔3❤2
Please open Telegram to view this post
VIEW IN TELEGRAM
👍4❤3🔥1
CHALLENGE
const a = false || 0 || "" || null || "JavaScript";
console.log(a);
🔥5👍3
🤔23🔥12👍8❤3
CHALLENGE
function Person(name) {
this.name = name;
this.sayName = () => console.log(this.name);
}
const person1 = new Person('David');
const person2 = { name: 'Not David', sayName: person1.sayName };
person2.sayName();
👍7🔥1
👍11🔥9❤4🤣1
GitHub Universe took place this week, flooding us with data about how folks are using the platform. Of interest to those on social media was that Python has taken JavaScript's #1 language crown, though many argued that TypeScript (now #3) made an impact here. In positive news, JS still ranks first for code pushes alone and there's been a 15% jump in npm package consumption in the past year.
GitHub
Please open Telegram to view this post
VIEW IN TELEGRAM
👍13🤔8❤1
CHALLENGE
const factorial = (function () {
const cache = {};
return function inner(n) {
if (n in cache) return cache[n];
return (cache[n] = n <= 1 ? 1 : n * inner(n - 1));
};
})();
console.log(factorial(5));
console.log(factorial(5));
🤔8🔥5👍4
🤔10👍7🔥6❤1
Uses whatever precise timing capabilities are available (e.g. process.hrtime or peformance.now). You can then benchmark whatever functions you want, specify how long or how many times to benchmark for, and get a variety of stats in return. GitHub repo.
Tinylibs
Please open Telegram to view this post
VIEW IN TELEGRAM
👍7❤2🔥2