JavaScript
32K subscribers
1.03K photos
9 videos
33 files
707 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 ❓

setTimeout(() => console.log('Timeout 1'), 100);

setTimeout(() => {
console.log('Timeout 2');
Promise.resolve().then(() => console.log('Promise in Timeout 2'));
}, 50);

Promise.resolve().then(() => console.log('Promise 1'));

setTimeout(() => console.log('Timeout 3'), 150);

console.log('Sync');
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘1
✌️ TC39 Advances 10+ ECMAScript Proposals

The architects behind the development of the ECMAScript / JavaScript spec got together again this week (you can see them in this tweet) and they had a packed agenda. Import attributes, Iterator helpers, Promise.try and Regexp modifiers all made it to stage 4, and more besides.

Sarah Gooding (Socket)
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3❀2πŸ”₯2
CHALLENGE ❓

async function first() {
console.log('First Start');
await second();
console.log('First End');
}

async function second() {
console.log('Second Start');
}

console.log('Script Start');
first();
setTimeout(() => console.log('Timeout'), 0);
console.log('Script End');
Please open Telegram to view this post
VIEW IN TELEGRAM
❀3πŸ‘1
πŸ‘€ DOCX 9.0: Generate Word .docx Files from JavaScript

The code to lay out documents is verbose but there’s a lot of functionality baked in and there aren’t many other options for this task. Here’s a CodePen-based example to give you an idea. GitHub repo.

Dolan Miu
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3❀2πŸ”₯2
CHALLENGE ❓


const obj = Object.freeze({
name: "Alice",
info: {
age: 25
}
});

try {
obj.name = "Bob";
obj.info.age = 30;
} catch (e) {
console.log("Error:", e.message);
}

console.log(obj.name, obj.info.age);
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘6πŸ”₯3❀1
CHALLENGE ❓


function* numberGenerator() {
let i = 0;
while (i < 3) {
yield i++;
}
}

const gen = numberGenerator();
console.log(gen.next().value);
console.log(gen.return(10).value);
console.log(gen.next().value);
Please open Telegram to view this post
VIEW IN TELEGRAM
🀩4πŸ‘2πŸ”₯1
πŸ€”10πŸ‘5❀2
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘10πŸ”₯2❀1🀩1
CHALLENGE ❓


function processData({ a = 10, b = 20 } = { a: 30 }) {
console.log(a, b);
}

processData({ a: 5 });
processData();
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘1
πŸ€”13πŸ‘7πŸ”₯2🀣1
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘7❀3πŸ”₯2
CHALLENGE ❓


const obj = {};
Object.defineProperty(obj, 'name', {
value: 'Alice',
writable: false,
configurable: false
});

try {
obj.name = 'Bob';
delete obj.name;
console.log(obj.name);
} catch (e) {
console.log('Error:', e.message);
}
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯3πŸ‘1
🀟 Node v20.18.0 (LTS) Released; v20 'Iron' Prepares to Bow Out as Active LTS Release

It’s been a quiet few weeks for official releases. This update marks one of the last in Node 20’s run as the active LTS release, and introduces experimental network inspection support. Node 22 will soon take over the active LTS crown (as per schedule) but what will its codename be given there are no elements starting with J? Amazingly, this question was asked six years ago and it's (probably) going to be Jod.

MichaΓ«l Zasso
Please open Telegram to view this post
VIEW IN TELEGRAM
❀6πŸ‘4πŸ”₯2
CHALLENGE ❓


const map = new Map();
const key1 = {};
const key2 = key1;

map.set(key1, "Value for key1");
map.set(key2, "Value for key2");

console.log(map.get({}));
console.log(map.get(key1));
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘3❀1
πŸ”₯8❀4πŸ‘4🀣4