π₯10π€7π5π€£5β€3
CHALLENGE
function trickyScope() {
var a = 10;
let b = 20;
const c = 30;
if (true) {
var a = 40;
let b = 50;
const c = 60;
console.log(a, b, c);
}
console.log(a, b, c);
}
trickyScope();
π18π€£8β€6π€2
What is the output?
Anonymous Quiz
12%
40 50 60 10 50 60
29%
40 50 60 40 20 30
50%
40 50 60 10 20 30
9%
40 50 60 40 50 30
β€19π11π₯6
CHALLENGE
function trickyFunction(num) {
let result = 0;
for (let i = 0; i < num; i++) {
result += i;
if (i % 2 === 0) {
result *= 2;
} else {
result -= 1;
}
}
return result;
}
console.log(trickyFunction(4));
π7β€2π₯1
π€30π16β€2π₯2
I know this sounds like a geographical piece, but this developerβs curiosity led to a fun blend of JavaScript and the always useful Overpass Turbo mapping tool.
Ivan Ludvig
Please open Telegram to view this post
VIEW IN TELEGRAM
π5β€4π₯1
CHALLENGE
function trickyScope() {
let x = 10;
if (true) {
let x = 20;
console.log(x); // A
}
console.log(x); // B
{
let x = 30;
console.log(x); // C
}
console.log(x); // D
}
trickyScope();
π₯9π4β€1
What is the output?
Anonymous Quiz
19%
10, 20, 30, 10
65%
20, 10, 30, 10
12%
20, 20, 30, 10
5%
10, 10, 30, 10
π23π€5β€3π₯3π€£2
framework comes a new way to build LLM-powered agents that perform various tasks, use knowledge bases, and hold memory. Think a meta-framework like Next.js but for AI agents. GitHub repo.
Mastra
Please open Telegram to view this post
VIEW IN TELEGRAM
β€8π2π₯2π€2
CHALLENGE
function trickyQuestion() {
var a = 1;
var b = 2;
return (function() {
delete a;
delete b;
return a + b;
})();
}
console.log(trickyQuestion());
π€11π5
π€30π₯11β€5π3π€£3
Node supports WeakMap and WeakRef for working with weak references and James is a big fan of the extra abstractions they unlock. A weak reference differs from a normal reference in that it doesnβt prevent a referenced object from being garbage collected β this might sound like it has limited value, but is quite useful in certain scenarios.
James Long
Please open Telegram to view this post
VIEW IN TELEGRAM
β€7π4π₯1
CHALLENGE
let a = 5; // binary: 0101
let b = 3; // binary: 0011
let c = a & b; // binary: 0001
let d = a | b; // binary: 0111
let e = a ^ b; // binary: 0110
console.log(c, d, e);
π7
π€£23π€13π10β€3
A TypeScript library to enhance fetch with schema validation, automatic response parsing, and type-safety, while maintaining the familiar ΥfetchΥ API.
Laurent Blondy
Please open Telegram to view this post
VIEW IN TELEGRAM
π₯8π4β€3
CHALLENGE
function trickyFunction(a) {
a = a || 42;
let result = (function(a) {
return a * 2;
})(a);
return result;
}
console.log(trickyFunction(0));
π8β€2
π11π€£11β€6π€2π₯1
CHALLENGE
let x = 1;
function outer() {
let x = 2;
function inner() {
console.log(x);
let x = 3;
}
inner();
}
outer();
π6β€2