JavaScript
31.9K subscribers
1.02K photos
9 videos
33 files
701 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 trickyFunction() {
var x = 10;
if (x > 5) {
let y = x * 2;
x = y;
}
return x;
}

console.log(trickyFunction());
πŸ‘11❀5
What is the output?
Anonymous Quiz
66%
20
10%
undefined
20%
10
3%
ReferenceError
πŸ‘31🀣20❀2πŸ€”1
🌦 awesome-nest-boilerplate

This is an ever-evolving, very opinionated architecture and dev environment for new node projects using NestJS.

NarHakobyan
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘9❀3πŸ”₯1
CHALLENGE

function trickyFunction() {
var obj = { a: 1 };
var anotherObj = obj;
obj.a = 2;
obj = { a: 3 };
anotherObj.a = 4;
return obj.a + anotherObj.a;
}

console.log(trickyFunction());
❀12πŸ€”6πŸ‘2
What is the output?
Anonymous Quiz
21%
6
43%
7
31%
8
6%
5
πŸ”₯27πŸ‘9❀5πŸ€”2
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘8πŸ”₯3❀1
CHALLENGE

async function fetchData() {
let data = 'initial';

const promise = new Promise((resolve) => {
setTimeout(() => {
resolve('fetched');
}, 1000);
});

promise.then((result) => {
data = result;
});

return data;
}

fetchData().then(console.log);
πŸ‘13❀2
πŸ€”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