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
async function asyncQuiz() {
console.log("Start");
const promise1 = new Promise((resolve) => {
setTimeout(() => resolve("Promise 1"), 1000);
});
const promise2 = new Promise((resolve) => {
setTimeout(() => resolve("Promise 2"), 500);
});
console.log(await promise1);
console.log(await promise2);
console.log("End");
}
asyncQuiz();
Please open Telegram to view this post
VIEW IN TELEGRAM
π2
What is the output?
Anonymous Quiz
26%
"Start", "End", "Promise 1", "Promise 2"
42%
"Start", "Promise 1", "Promise 2", "End"
27%
"Start", "Promise 2", "Promise 1", "End"
5%
This will result in an error.
π€15 7β€4π3
Run JavaScript within a .NET app and expose .NET objects and functions to JavaScript code. v3 arrives after seven years of work and is the most standards-compliant JS engine running entirely within .NET.
SΓBASTIEN ROS
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€4 1
const fetchData = async (id) => {
return new Promise((resolve) => {
setTimeout(() => resolve(`Data for ID ${id}`), 100);
});
};
const ids = [1, 2, 3];
async function complexAsyncFetch(ids) {
const result = await ids.reduce(async (acc, id) => {
const data = await fetchData(id);
const currentResult = await acc;
currentResult.push(data);
return currentResult;
}, Promise.resolve([]));
console.log(result);
}
complexAsyncFetch(ids);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€5
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£71π12 11β€3π€©3π€1
function recursiveFibonacci(n) {
return n <= 1 ? n : recursiveFibonacci(n - 1) + recursiveFibonacci(n - 2);
}
const result = recursiveFibonacci(6);
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π9
π€16 8β€5π5
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£107π10β€4 3
function recursivePalindromeCheck(str) {
if (str.length <= 1) {
return true;
}
return str[0] === str[str.length - 1] && recursivePalindromeCheck(str.slice(1, -1));
}
const result = recursivePalindromeCheck("radar");
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
What is the output?
Anonymous Quiz
59%
true
24%
false
9%
This will result in an error.
8%
The output is not predictable.
π9 5β€3π€3
Please open Telegram to view this post
VIEW IN TELEGRAM
π14π€©3 3β€2π€2
function recursiveBinarySearch(arr, target, start = 0, end = arr.length - 1) {
if (start > end) {
return -1;
}
const mid = Math.floor((start + end) / 2);
if (arr[mid] === target) {
return mid;
} else if (arr[mid] < target) {
return recursiveBinarySearch(arr, target, mid + 1, end);
} else {
return recursiveBinarySearch(arr, target, start, mid - 1);
}
}
const result = recursiveBinarySearch([1, 2, 3, 4, 5, 6, 7, 8, 9], 6);
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€12π1
π€9π8 6π€£4β€3π€©2
Taking the manual, 'do it all by hand' approach. A good way to learn about all the pieces involved before automating it, perhaps.
SAM MEECH-WARD
Please open Telegram to view this post
VIEW IN TELEGRAM
β€9π4 2