JavaScript
31.9K subscribers
1.01K photos
9 videos
33 files
693 links
A resourceful newsletter featuring the latest and most important news, articles, books and updates in the world of #javascript πŸš€ Don't miss our Quizzes!

Let's chat: @nairihar
Download Telegram
What is the output?
Anonymous Quiz
61%
5 10
16%
5 5
9%
10 10
14%
10 5
πŸ”₯10πŸ€”7πŸ‘5🀣5❀3
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘6❀3πŸ”₯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
❀19πŸ‘11πŸ”₯6
Please open Telegram to view this post
VIEW IN TELEGRAM
❀6πŸ‘3πŸ”₯2
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
What is the output?
Anonymous Quiz
19%
12
20%
10
25%
8
36%
6
πŸ€”30πŸ‘16❀2πŸ”₯2
✌️ Do Lake Names Reflect Their Properties?

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
πŸ‘23πŸ€”5❀3πŸ”₯3🀣2
πŸ‘€ Mastra: A TypeScript AI Framework from the Gatsby Team β€” From some of the folks behind the Gatsby React

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
What is the output?
Anonymous Quiz
26%
3
37%
undefined
23%
NaN
14%
ReferenceError
πŸ€”30πŸ”₯11❀5πŸ‘3🀣3
πŸ€” Subverting Control with Weak References

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
What is the output?
Anonymous Quiz
31%
5 3 2
19%
1 3 2
41%
1 7 6
8%
0 1 2
🀣23πŸ€”13πŸ‘10❀3
πŸ₯Ά upfetch: An Advanced fetch Client Builder

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
What is the output?
Anonymous Quiz
57%
84
27%
0
13%
42
3%
2
πŸ‘11🀣11❀6πŸ€”2πŸ”₯1
πŸ”΅πŸ‘©β€πŸ¦― CSS linting with @eslint/css
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯12❀3πŸ‘2
CHALLENGE

let x = 1;
function outer() {
let x = 2;
function inner() {
console.log(x);
let x = 3;
}
inner();
}
outer();
πŸ‘6❀2