JavaScript
32K subscribers
1.03K photos
10 videos
33 files
715 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
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โ“ CHALLENGE


const weakMap = new WeakMap();
const objs = [{}, {}, {}];

objs.forEach((obj, index) => weakMap.set(obj, index + 1));

const result = objs.filter(obj => weakMap.has(obj)).map(obj => weakMap.get(obj) * 2);

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
2๐Ÿ‘6โค3๐Ÿ”ฅ3๐Ÿค”3
What is the output?
Anonymous Quiz
23%
[1, 2, 3]
20%
Error
10%
[]
47%
[2, 4, 6]
๐Ÿ‘6
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โœŒ๏ธ JavaScript Weekly #โ€‹701
Please open Telegram to view this post
VIEW IN TELEGRAM
2๐Ÿ‘6โค3๐Ÿ”ฅ2
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

๐ŸŒฒ Node.js Security release process

Only those who have been involved in a security release process know how hard it is (time-consuming, effort).
We've been working hard to automate most (if not all) of the process and the new security release process is live

Rafael Gonzaga
Please open Telegram to view this post
VIEW IN TELEGRAM
2โค4๐Ÿ‘3๐Ÿ”ฅ2
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โ“ CHALLENGE


const obj = {
a: 1,
b: 2
};

let a = 10;
let b = 20;

with (obj) {
a += 1;
b += 1;
}

console.log(a, obj.a, b, obj.b);
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿค”11๐Ÿ‘3โค1
2๐Ÿ”ฅ13๐Ÿ‘7๐Ÿค”4โค3
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โ“ CHALLENGE


const obj1 = {
name: "Alice",
age: 25
};

const obj2 = {
age: 30,
city: "Wonderland"
};

with (obj1) {
with (obj2) {
name = "Bob";
console.log(name, age);
}
}
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿค”9๐Ÿคฉ7๐Ÿ‘5โค1
2๐Ÿ‘14๐Ÿค”7๐Ÿ”ฅ5โค3
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

๐Ÿ”ฅ Billionaire Pavel Durov arrested... The truth about Telegram

Fireship
Please open Telegram to view this post
VIEW IN TELEGRAM
2โค10๐Ÿคฃ6๐Ÿ‘4
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โœŒ๏ธ Regexes Got Good: The History (and Future) of Regular Expressions in JavaScript

Regular expression support was always a little underwhelming in JS, but things have improved. Steven takes us on a tour to refresh our knowledge, as well as show off his โ€˜regexโ€™ library that boosts JS regexes to a true A++ rating. Steven was co-author of Oโ€™Reillyโ€™s Regular Expressions Cookbook and High Performance JavaScript so knows his stuff.

Steven Levithan
Please open Telegram to view this post
VIEW IN TELEGRAM
2๐Ÿ‘6๐Ÿ”ฅ5โค3
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โ“ CHALLENGE


const weakMap = new WeakMap();
const arr = [1, 2, 3].map(n => ({ n }));

arr.forEach(obj => weakMap.set(obj, obj.n * 2));

arr.pop(); // Remove the last element

const result = arr.reduce((acc, obj) => acc + weakMap.get(obj), 0);

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
โค2
What is the output?
Anonymous Quiz
24%
2
49%
6
17%
4
10%
10
2๐Ÿ‘8๐Ÿ”ฅ4๐Ÿค”3โค1
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

๐ŸŒฒ LogTape: Simple Logging Library with Zero Dependencies

Iโ€™m digging this new style of library that promises support across all the main runtimes (Node, Deno, Bun) as well as edge functions and browser devtools.

Hong Minhee
Please open Telegram to view this post
VIEW IN TELEGRAM
2๐Ÿ‘4โค1๐Ÿ”ฅ1
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โ“ CHALLENGE


function* infiniteGenerator() {
let i = 0;
while (true) {
yield i++;
}
}

const weakMap = new WeakMap();
const gen = infiniteGenerator();

weakMap.set(gen, gen.next().value);

const result = weakMap.get(gen) + gen.next().value;

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
2๐Ÿ‘15๐Ÿ”ฅ4โค3
What is the output?
Anonymous Quiz
33%
1
32%
2
23%
undefined
13%
Error
๐Ÿ”ฅ8๐Ÿ‘3
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

๐Ÿ‘ธ Milkdown: Plugin-Driven WYSIWYG Markdown Editor Framework

A lightweight WYSIWYG Markdown editor based around a plugin system that enables a significant level of customization. Itโ€™s neat to see the docs are rendered by the editor itself. GitHub repo.

Mirone
Please open Telegram to view this post
VIEW IN TELEGRAM
2โค3๐Ÿ‘3๐Ÿ”ฅ3
๐Ÿ‘8โค1๐Ÿ”ฅ1๐Ÿคฃ1
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โ“ CHALLENGE


const weakMap = new WeakMap();
let obj = { name: 'initial' };

function changeName(obj) {
weakMap.set(obj, obj.name);
obj.name = 'changed';
}

changeName(obj);

console.log(weakMap.get(obj));
Please open Telegram to view this post
VIEW IN TELEGRAM
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โ“ CHALLENGE


const weakMap = new WeakMap();
const arr = [1, 2, 3, 4];
const objs = arr.map(n => ({ n }));

objs.forEach((obj, index) => weakMap.set(obj, arr.slice(0, index + 1)));

const result = objs.map(obj => weakMap.get(obj).reduce((acc, num) => acc + num, 0));

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘7โค2๐Ÿค”2
5๐Ÿ”ฅ7๐Ÿ‘2
Sponsored by Bryntum ๐Ÿ‘ฎโ€โ™€๏ธ
World Class Web Components

โ“ CHALLENGE


const weakMap = new WeakMap();
const arr = [{}, {}, {}];

arr.forEach((obj, index) => weakMap.set(obj, index));

arr.splice(1, 1); // Remove the second element

const result = arr.map(obj => weakMap.get(obj));

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘5๐Ÿ”ฅ2โค1