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
πŸ€”16πŸ‘14🀣11❀2πŸ”₯2
😒
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣75πŸ€”13🀩2
CHALLENGE

const WM = new WeakMap();
let obj = {};
let anotherObj = {};
WM.set(obj, 'object data');
WM.set(anotherObj, 'another object data');
obj = null;

// Let's check what's logged
console.log(WM.has(obj));
console.log(WM.has(anotherObj));
πŸ‘9❀1
❀7πŸ‘6πŸ”₯4
CHALLENGE

const mySet = new Set();
mySet.add(10);
mySet.add(20);
mySet.add(10);
mySet.add(30);

console.log(mySet.size);
πŸ‘13
What is the output?
Anonymous Quiz
44%
3
44%
4
6%
2
6%
1
πŸ€”29🀣22πŸ‘15❀10🀩1
CHALLENGE

function* customGenerator() {
yield 'Hello';
yield 'World';
return 'Done';
}

const gen = customGenerator();
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next().value);
πŸ‘7❀1
πŸ‘14🀣14❀8
CHALLENGE

const myObject = {
a: 1,
b: 2,
c: 3,
[Symbol.iterator]: function* () {
for (let key of Object.keys(this)) {
yield this[key];
}
}
};

const iter = myObject[Symbol.iterator]();
console.log(iter.next().value);
console.log(iter.next().value);
console.log(iter.next().value);
❀3πŸ‘3🀩1
❀12🀣10
⭐ 2024's JavaScript Rising Stars

It’s time to fully wave goodbye to 2024, but not before Michael Rambeau’s annual analysis of which JavaScript projects fared best on GitHub over the past year. Even if you dislike GitHub stars as a metric for anything, this remains a great way to get a feel for the JavaScript ecosystem and see what libraries and tools have mindshare in a variety of niches. A fantastic roundup as always.

Michael Rambeau
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘10❀2πŸ”₯2
CHALLENGE

var obj = { a: 10, b: 20 };

with (obj) {
var result = a + b;
}

console.log(result);
πŸ‘4❀1
What is the output?
Anonymous Quiz
16%
undefined
10%
Error
69%
30
5%
NaN
🀣23πŸ‘7πŸ€”7❀4πŸ”₯2
πŸ‘€ PostalMime: A Universal Email Parsing Library

An email parsing library happy in most JS runtimes. Takes the raw source of emails and parses them into their constituent parts.

Postal Systems
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘7❀2πŸ”₯1
CHALLENGE

function trickyFunction() {
let a = 5;
let b = '5';
let c = 5;

if (a == b && b === c) {
console.log('Condition 1');
} else if (a === c || b == c) {
console.log('Condition 2');
} else {
console.log('Condition 3');
}
}

trickyFunction();
πŸ‘6πŸ”₯2
πŸ‘27🀣15❀4πŸ€”4πŸ”₯1
πŸ“„ Play Tetris in a PDF File

I'll let you decide if this one is fun or frightening! Whether or not this will work depends on your PDF reader or browser support, but it works with Chrome and Firefox, at least.

The PDF document format supports embedded JavaScript and this experiment uses it to implement a game of Tetris. The developer, Thomas Rinsma, has used Python to output the PostScript that includes the game's JavaScript. Couple that with the fact many browser PDF renderers are themselves implemented in JavaScript (e.g. PDF.js) and you have a veritable Matryoshka doll of technologies at play here.
🀣10πŸ‘6❀2πŸ€”2
CHALLENGE

function displayArguments() {
console.log(arguments.length);
console.log(arguments[0]);
console.log(arguments[2]);
}

displayArguments('Hello', 'World', 'JavaScript', 'Quiz');
πŸ€”8🀣7❀3πŸ‘3πŸ”₯2
🀣23πŸ‘20❀6
πŸ‘ˆ Tagify 4.33: An Elegant Input Component for Tags

The polished demos show a lot of effort has been put in here. GitHub repo.

Yair Even-Or
Please open Telegram to view this post
VIEW IN TELEGRAM
❀4πŸ‘3πŸ”₯2πŸ€”1