Together, we're creating a community that thrives on knowledge, support, and positive vibes.
Cheers to 9K and beyond!
Please open Telegram to view this post
VIEW IN TELEGRAM
β€13 12π9π€©2
const array = [1, 2, 3, 4, 5];
const result = array.map(num => Promise.resolve(num * 2));
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€9π3π₯1
What is the output?
Anonymous Quiz
60%
[2, 4, 6, 8, 10]
25%
[Promise, Promise, Promise, Promise, Promise]
10%
[undefined, undefined, undefined, undefined, undefined]
6%
This will result in an error.
π€23π8 8β€2
Please open Telegram to view this post
VIEW IN TELEGRAM
async function complexAsyncFunction() {
const promise1 = new Promise(resolve => setTimeout(() => resolve(10), 1000));
const promise2 = new Promise(resolve => setTimeout(() => resolve(20), 500));
const result = await Promise.race([promise1, promise2]);
console.log(result);
}
complexAsyncFunction();
Please open Telegram to view this post
VIEW IN TELEGRAM
β€14π5π€©4
The AHA Stack is a full-stack webapp approach that brings together Astro, htmx, and Alpine.js, and where you send HTML over the wire. This is a fantastic showcase site that sells the idea well, complete with explanations and examples.
FLAVIO COPES
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€6π€£5π€©1
const array = [
{ name: 'John', score: 80 },
{ name: 'Jane', score: 95 },
{ name: 'Doe', score: 88 },
];
const result = array.every(obj => obj.score >= 80);
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€10π5π€3
What is the output?
Anonymous Quiz
53%
[true, true, true]
7%
[false, false, false]
10%
false
30%
true
β€19π6π€©5 3π€£2
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£60β€4π4π€2
const array = [
{ name: 'Alice', age: 25 },
{ name: 'Bob', age: 30 },
{ name: 'Charlie', age: 22 },
];
const result = array.find(obj => obj.age === 30);
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π7β€4
What is the output?
Anonymous Quiz
82%
{ name: 'Bob', age: 30 }
7%
{ name: 'Charlie', age: 22 }
2%
{ name: 'Alice', age: 25 }
8%
undefined
π€£23π8 7π€©6β€1
It has no dependencies, and is small, responsive, and themeable. GitHub repo.
WILLIAM TROUP
Please open Telegram to view this post
VIEW IN TELEGRAM
function asyncSum(arr) {
return arr.reduce(async (acc, num) => (await acc) + num, Promise.resolve(0));
}
async function computeTotal() {
const result = await asyncSum([1, 2, 3, 4, 5]);
console.log(result);
}
computeTotal();
Please open Telegram to view this post
VIEW IN TELEGRAM
What is the output?
Anonymous Quiz
27%
Promise { 15 }
43%
15
19%
012345
10%
This will result in an error.
Popular dev YouTuber Jack demonstrates building a Wordle clone with a modern Alpine, HTMX and Astro-based stack. Or you can go straight to the code, if you prefer.
JACK HERRINGTON
Please open Telegram to view this post
VIEW IN TELEGRAM
π6π€6π€£6 4β€2
const matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
];
async function complexMatrixOperation(matrix) {
const result = await Promise.all(matrix.map(async row => {
return await Promise.all(row.map(async num => {
if (num % 2 === 0) {
return await new Promise(resolve => setTimeout(() => resolve(num * 3), 200));
} else {
return await new Promise(resolve => setTimeout(() => resolve(num * 2), 100));
}
}));
}));
console.log(result);
}
complexMatrixOperation(matrix);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€13π6π€5π€©5 5
What is the output?
Anonymous Quiz
12%
This will result in an error.
33%
[[6, 12, 18], [24, 20, 36], [42, 48, 54]]
24%
[[2, 4, 6], [8, 10, 12], [14, 16, 18]]
31%
[[2, 6, 6], [12, 10, 18], [14, 24, 18]]
π€7 5π3π€©3
Several years ago, Fabrice Bellard, the genius behind FFMPEG and JSLinux, built a tiny and complete JavaScript engine in C. It now supports ES2023 and its latest release adds top-level
await in modules and its REPL, as well as support for some cutting edge JS features (changelog).FABRICE BELLARD
Please open Telegram to view this post
VIEW IN TELEGRAM
π9β€4 4π€©1