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
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
πŸ€”18πŸ‘10❀5🀣2
πŸ₯Ά Developer Implements 'Doom' in TypeScript's Type System

A curious quirk of TypeScript’s type system is that it is Turing-complete which has led some developers to implement apps entirely in the type system. One such developer has spent eighteen months producing 177 terabytes of types to get 1993’s Doom running with them. Ridiculous and amazing in equal measure, he πŸ˜‰ explains the project in this widely lauded 7-minute video.

Sarah Gooding (Socket)
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘8❀5πŸ”₯4
CHALLENGE

const user = {
name: 'John',
greet() {
const getName = () => {
console.log(this.name);
};
getName();
},
farewell: function() {
function getName() {
console.log(this.name);
}
getName();
}
};

user.greet();
user.farewell();
πŸ‘2
πŸ€”16πŸ‘15🀣5❀4πŸ”₯4
🟠 Svelvet 11: Build Node-Based UIs with Svelte

A mature Svelte component library for creating interactive node-based UIs and diagrams. v11 adds the ability to toggle between β€˜snap grid’ and freeform modes for manipulating elements. (There’s a live demo at the bottom of the homepage.)

Open Source Labs
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘4πŸ”₯2❀1
CHALLENGE

const arr = [1, 2, 3, 4, 5];
const result = arr
.map(x => x * 2)
.filter(x => x > 5)
.reduce((acc, val) => {
return acc + (val % 3 === 0 ? val : 0);
}, 0);

console.log(result);
πŸ‘12
What is the output?
Anonymous Quiz
13%
9
63%
6
15%
12
9%
18
πŸ‘16❀7πŸ€”6