JavaScript
32K subscribers
1.04K photos
10 videos
33 files
722 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
πŸ‘8❀3πŸ”₯2
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘7πŸ”₯3
CHALLENGE

async function asyncFunc() {
return 'async';
}

function promiseFunc() {
return new Promise(resolve => resolve('promise'));
}

(async function() {
const result = await (true ? asyncFunc() : promiseFunc());
console.log(result);
})();
πŸ‘7
What is the output?
Anonymous Quiz
14%
Error
20%
undefined
27%
promise
39%
async
πŸ‘7❀5πŸ”₯5πŸ€”2
🌲 Node v22.3.0 (Current) Released

One of those releases where lots of tiny things have occurred, but little of broad significance, except… for snapshot testing! Snapshot tests serialize arbitrary values into string values to be compared against a set of pre-built known β€˜good’ values (stored as a β€˜snapshot’ representing a desired state).

Rafael Gonzaga
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘7❀3🀩2
CHALLENGE

const obj1 = {
a: 1,
method() {
return this.a;
}
};

const obj2 = Object.create(obj1);
obj2.a = 2;

console.log(obj2.method());
πŸ”₯7πŸ‘1🀩1
What is the output?
Anonymous Quiz
10%
Error
20%
undefined
54%
2
15%
1
πŸ”₯8πŸ€”7πŸ‘4❀3
πŸ˜‰ 3D in TypeScript with Raycasting

Raycasting is a somewhat old fashioned technique to render 3D environments (you may have seen it in 1992’s Wolfenstein 3D) but it’s easy to understand and worth implementing at least once.

Tsoding Daily
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘9❀3πŸ”₯3
CHALLENGE

async function asyncFunc() {
return 'async function';
}

function* generator() {
yield 'generator';
yield asyncFunc();
yield 'done';
}

const gen = generator();
(async function() {
console.log(gen.next().value);
console.log(await gen.next().value);
console.log(gen.next().value);
})();
πŸ‘9❀3πŸ”₯3
✌️ The Results of the State of JavaScript 2023 Survey

It feels odd including something about 2023 in June 2024, but the results of the major annual JavaScript developer survey are now out. It’s interesting to see what features JS devs do and don’t use, changes in library popularity over time, what build tools people are using, the divide between JavaScript and TypeScript usage, and much more besides.

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

const obj1 = { a: 1 };
const obj2 = Object.create(obj1);
obj2.b = 2;

console.log(obj2.a, obj2.b);
console.log(obj2.hasOwnProperty('a'));
console.log(Object.getPrototypeOf(obj2) === obj1);
πŸ‘9❀2
❀4πŸ‘4🀩1🀣1
πŸ˜†
Please open Telegram to view this post
VIEW IN TELEGRAM
🀣88πŸ€”6πŸ‘5❀3πŸ”₯2🀩1
CHALLENGE

const array = [1, 2, 3, 4, 5];
const result = array.filter(n => n % 2).map(n => n * 2);

console.log(result);
❀13πŸ”₯3🀩1
❀23πŸ‘9🀩3
Please open Telegram to view this post
VIEW IN TELEGRAM
❀4πŸ‘3πŸ”₯1
CHALLENGE

const arr = [1, 2, 3, 4, 5];
const [first, , third, ...rest] = arr;

console.log(first, third, rest);
πŸ”₯8❀4πŸ‘1
❀10πŸ‘9πŸ€”7
πŸ‘€ PixelMatch 6.0: A Fast Pixel-Level Image Comparison Library

Give it two images, it’ll highlight the differences. Now distributed as a ES module.

Mapbox
Please open Telegram to view this post
VIEW IN TELEGRAM
πŸ‘9❀3πŸ”₯3
CHALLENGE
const obj = {};
let value = 0;

Object.defineProperty(obj, 'prop', {
get() {
return value;
},
set(newValue) {
value = newValue + 1;
},
configurable: true,
enumerable: true
});

obj.prop = 10;
console.log(obj.prop);
πŸ‘4🀩3❀2