JavaScript
32K subscribers
1.02K photos
9 videos
33 files
705 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

const factorial = (function () {
const cache = {};
return function inner(n) {
if (n in cache) return cache[n];
return (cache[n] = n <= 1 ? 1 : n * inner(n - 1));
};
})();

console.log(factorial(5));
console.log(factorial(5));
πŸ€”8πŸ”₯5πŸ‘4
What is the output?
Anonymous Quiz
53%
120, 120
20%
120, undefined
12%
Error
15%
5, 5
πŸ€”10πŸ‘7πŸ”₯6❀1
🌲 Tinybench 3.0: A Tiny, Simple Benchmarking Library

Uses whatever precise timing capabilities are available (e.g. process.hrtime or peformance.now). You can then benchmark whatever functions you want, specify how long or how many times to benchmark for, and get a variety of stats in return. GitHub repo.

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

const obj = { value: 10 };
const result = (obj.value += 5) && obj.value;
console.log(result);
πŸ‘2
What is the output?
Anonymous Quiz
7%
5
71%
15
12%
undefined
10%
Error
πŸ‘18❀4πŸ”₯3
🫑 Faker 9.1: Generate Fake, Realistic Data on Demand

Names, bios, addresses, zip codes, dates, monetary amounts, transactions, and a lot more besides. I really like the guided DevTools console based demo you can try – an idea other projects should consider. GitHub repo.

Faker.js Team
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘7πŸ”₯4❀2
CHALLENGE

async function test() {
return (await Promise.resolve(0)) || 10;
}

test().then(console.log);
πŸ‘11
What is the output?
Anonymous Quiz
25%
0
49%
10
17%
undefined
9%
Error
🀩9πŸ‘6❀3
🀟 Why Code Security Matters - Even in Hardened Environments

A nicely diagrammed deep dive (and it really is deep) into a technique that allows malicious parties to turn a file write vulnerability in a Node app into a remote code execution exploit even when the file system is mounted read-only.

Stefan Schiller (Sonar)
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4❀2πŸ‘2πŸ€”1
CHALLENGE

const arr = [1, 2, 3];
const copy = [...arr];
copy.push(4);

console.log(arr);
console.log(copy);
πŸ‘4
πŸ‘15❀10πŸ”₯9πŸ€”1
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘8❀3πŸ”₯2🀩1
CHALLENGE ❓


console.log(typeof typeof 42);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘5πŸ”₯3❀2
What is the output?
Anonymous Quiz
39%
number
31%
string
17%
object
13%
Error
🀣26πŸ€”15πŸ‘8❀1
✌️ JavaScript's ??= Operator: Default Values Made Simple

The ??= nullish coalescing assignment operator snuck into JavaScript a few years ago via ECMAScript 2021 and has been broadly supported almost everywhere for ages. Trevor shows off how it can tighten up your assignments here.

Trevor I. Lasn
Please open Telegram to view this post
VIEW IN TELEGRAM
❀8πŸ”₯4πŸ‘3
CHALLENGE ❓


let name = "Alice";
(function() {
let name = "Bob";
console.log(name);
})();
console.log(name);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘2πŸ”₯1
πŸ‘18❀4πŸ”₯4
⛽️ npmpackage.info: Detailed Package Info on a Single Page

Give this online tool the name of an npm package and you get a quick β€˜dashboard’ style view of the project’s main statistics, covering areas like quality scores, commits, open issues, releases, bundle size, and more.

Shrinath Nayak
Please open Telegram to view this post
VIEW IN TELEGRAM
❀3πŸ‘2πŸ”₯2🀩1
CHALLENGE ❓


const sym1 = Symbol("id");
const sym2 = Symbol("id");
console.log(sym1 === sym2);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3
What is the output?
Anonymous Quiz
50%
true
8%
undefined
5%
Error
36%
false
πŸ€”32🀣31❀3πŸ‘3πŸ”₯3
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘6❀2πŸ”₯2