JavaScript
32.1K subscribers
1.06K photos
10 videos
33 files
737 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 ❓
let x = 5;
let result = typeof (x + "10");

console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘4❀3
What is the output?
Anonymous Quiz
26%
number
57%
string
12%
Error
5%
object
❀22πŸ‘9πŸ€”9🀩21
πŸ—£οΈ Why is it called a REST API when it wakes me up at 3 AM to fix it?

Zach Wilson
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣875πŸ€”3🀩2
❓ CHALLENGE

function foo() {
let a = b = 0
a++
return a
}

foo()
console.log(typeof a)
console.log(typeof b)
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ€”22πŸ‘8❀2
πŸ‘247❀2πŸ€”2
Please open Telegram to view this post
VIEW IN TELEGRAM
17❀9
❓ CHALLENGE

const obj = {
a: 1,
b: function() {
console.log(this.a);
}
};
const func = obj.b;
func();
Please open Telegram to view this post
VIEW IN TELEGRAM
❀10πŸ‘61
πŸ€”33πŸ‘1510❀1🀩1
πŸ˜‚
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣98πŸ€”17❀63
❓ CHALLENGE

function* generator() {
yield 1;
yield 2;
yield 3;
}
const gen = generator();
console.log(gen.next().value);
console.log(gen.next().value);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3❀2
What is the output?
Anonymous Quiz
14%
1, null
24%
1, undefined
52%
1,2
9%
1, 1
πŸ€”22πŸ‘12❀74
🀟 __dirname is Back in Node with ES Modules

In an ES module, instead of using __dirname or __filename, you can now use import.iss.oneta.dirname and import.iss.oneta.filename (this came with Node 20.11.0 (LTS) released in January).

PHIL NASH
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘94❀2
❓ CHALLENGE

const a = { a: 1 };
const b = Object.assign({}, a);
b.a = 2;
console.log(a.a);
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣20πŸ€”13πŸ‘11❀77
✌️ Optimizing Javascript for fun and for profit

Interesting benchmarks 🍊

romgrk
Please open Telegram to view this post
VIEW IN TELEGRAM
❀7πŸ‘3πŸ€”11
❓ CHALLENGE

const a = [1, 2, 3];
const b = a.slice(0, 2).push(4);
console.log(b);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2
What is the output?
Anonymous Quiz
56%
[1, 2, 4]
11%
[1, 2]
8%
3
25%
4
πŸ€”70🀣25πŸ‘16❀51
✌️ JavaScript Visualized: Promise Execution

A helpful diagrammed and animated article, coupled with an (optional) 8-minute video, that goes into how promises work and are scheduled behind the scenes. It’s useful to have a good mental model of these mechanics, given promises form the basis of asynchronous functions in JavaScript.

LYDIA HALLIE
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘125❀4πŸ€”1
❓ CHALLENGE

const a = [1, 2, 3];
const b = a.flatMap(x => [x, x * 2]);
console.log(b);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘9❀1
🀩15❀8πŸ‘4