JavaScript
32.1K subscribers
1.04K photos
10 videos
33 files
723 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* generator() {
const value = yield 1;
yield value;
}

const gen = generator();
console.log(gen.next().value);
console.log(gen.next(2).value);
πŸ‘4πŸ€”2
❀13πŸ€”7🀣2🀩1
Please open Telegram to view this post
VIEW IN TELEGRAM
❀3πŸ‘2
CHALLENGE

function* generator() {
yield 1;
yield 2;
return 3;
}

const gen = generator();
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next().value);
πŸ‘2πŸ”₯2
πŸ”₯11❀4πŸ‘4πŸ€”4
Even though Armenia πŸ‡¦πŸ‡² is a small country, we have a really big JavaScript community 😎.
There are many events related to JavaScript, and another one is happening tomorrow: JSConf Armenia 2024!

If you are in Armenia and would like to attend, just grab your tickets from the website.
❀17πŸ‘7🀣7πŸ”₯4
CHALLENGE

function* generator() {
yield 1;
yield new Promise(resolve => resolve(2));
yield 3;
}

const gen = generator();
console.log(gen.next().value);
gen.next().value.then(console.log);
console.log(gen.next().value);
πŸ‘5🀩2❀1
πŸ‘9πŸ”₯8❀4
✌️ Promises from the Ground Up

Josh notes that in order to truly understand promises, a fundamental part of modern JS development, we need β€œa surprisingly deep understanding of how JavaScript works and what its limitations are”. Luckily, this tutorial covers all the critical context you need.

Josh W Comeau

πŸ‘€ If you're a bit more advanced, you might enjoy Alex MacArthur's look at controlling promises using Promise.withResolvers().
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘8❀2πŸ”₯2
✌️ SOME UPDATES

JavaScript Weekly
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘7
CHALLENGE

let obj1 = { key: 'value1' };
let obj2 = { key: 'value2' };

const map = new Map();
const weakMap = new WeakMap();

map.set(obj1, 'mapValue');
weakMap.set(obj2, 'weakMapValue');

obj1 = null; // Changing reference
obj2 = null; // Changing reference

console.log(map.has(obj1));
console.log(weakMap.has(obj2));
❀7πŸ‘4πŸ”₯4
πŸ€”22πŸ”₯4🀣4πŸ‘3❀2
CHALLENGE

function* genFunc() {
yield Symbol('A');
yield new Function('return this')();
}

const obj = { key: genFunc().next().value };
obj.key = genFunc().next().value;

console.log(obj.key === globalThis);
πŸ€”5❀4πŸ”₯2πŸ‘1
What is the output?
Anonymous Quiz
37%
false
37%
true
14%
Error
12%
undefined
πŸ€”11❀3🀣2πŸ‘1
😯 Motion Canvas: Create Dynamic Canvas-Rendered Animations

There’s two parts. A library where you use generator functions to procedurally define animations, and an editor that provides a real-time preview of said animations which you can see in action here.

Motion Canvas
Please open Telegram to view this post
VIEW IN TELEGRAM
❀3πŸ‘3πŸ”₯3🀣3
CHALLENGE

const secret = 'hidden';
function revealSecret() {
const secret = 'revealed';
const obj = { secret: 'object secret' };
with (obj) {
return () => secret;
}
}

const mySecret = revealSecret()();
console.log(mySecret);
πŸ‘5πŸ€”5❀4πŸ”₯2
πŸ”₯9πŸ€”7🀩3❀2
❓ KaTeX: The Fastest Math Typesetting Library for the Web

All these AI And machine learning papers and blog posts these days are crammed with mathematical notation, so how about a no dependency, TeX-based approach to rendering them? The sandbox demo page shows off how smooth it is.

Emily Eisenberg and Sophie Alpert
Please open Telegram to view this post
VIEW IN TELEGRAM
❀4πŸ‘2πŸ”₯2
CHALLENGE

const secretKey = Symbol('key');
const secretValue = 'secret';

function Store() {
this[secretKey] = secretValue;
}

Store.prototype.get = function(key) {
return this[key];
};

const store = new Store();
const revealed = store.get(secretKey);
console.log(revealed);
πŸ”₯7πŸ‘6❀3
🌲 10 Modern Node.js Runtime Features to Start Using in 2024

If it ever feels like the new feature spotlight shines too much on Bun or Deno, never fear - Node has been taking huge strides forward too. Liran helps us catch up with a lot of the newest Node features.

Liran Tal
Please open Telegram to view this post
VIEW IN TELEGRAM
❀5πŸ‘4πŸ”₯2