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 ❓

console.log('A');
setTimeout(() => console.log('B'), 0);
Promise.resolve().then(() => console.log('C'));
console.log('D');
Please open Telegram to view this post
VIEW IN TELEGRAM
❀5πŸ‘2
❀10πŸ‘9πŸ”₯1🀣1
πŸ˜‚
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣132πŸ”₯5πŸ€”2🀩1
CHALLENGE ❓

setTimeout(() => {
console.log('setTimeout 1');
Promise.resolve().then(() => console.log('Promise 1'));
}, 0);

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

console.log('Sync');
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘13
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘5❀2πŸ”₯2
CHALLENGE ❓

async function asyncFunc() {
console.log('Async Start');
await new Promise(resolve => setTimeout(resolve, 100));
console.log('Async End');
}

console.log('Script Start');
asyncFunc();
setTimeout(() => console.log('Timeout 1'), 50);
setTimeout(() => console.log('Timeout 2'), 150);
console.log('Script End');
Please open Telegram to view this post
VIEW IN TELEGRAM
❀4πŸ‘1
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ”₯4πŸ‘2❀1
CHALLENGE ❓

setTimeout(() => {
console.log('Timeout');
Promise.resolve().then(() => console.log('Promise after Timeout'));
}, 0);

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

console.log('End of script');
Please open Telegram to view this post
VIEW IN TELEGRAM
❀2πŸ‘2
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