JavaScript
31.7K subscribers
992 photos
9 videos
33 files
679 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
✌️ Driver.js: Tours, Highlights, Contextual Help, and More

A vanilla JS library for making on-page tours and contextual help systems. It’s been around for several years, but is still maintained, and there are lots of examples to check out – it’s really smooth.

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

function mystery() {
try {
console.log('A');
throw new Error('Oops');
console.log('B');
} catch (err) {
console.log('C');
return 'D';
} finally {
console.log('E');
return 'F';
}
console.log('G');
return 'H';
}

console.log(mystery());
❀5
🀣6πŸ‘3❀2πŸ€”2
🌲 You Don’t Know Node.js EventLoop

The Ultimate Guide to Understanding EventLoop in Node.js

This comprehensive guide is going to take some time to cover every detail that you need to know, so grab a cup of coffee and settle in for an exciting journey to the fascinating world of Node.js. Let’s get started!

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

const compose = (...fns) => x => fns.reduceRight((acc, fn) => fn(acc), x);

const addTwo = num => num + 2;
const multiplyByThree = num => num * 3;
const subtractTen = num => num - 10;

const calculate = compose(subtractTen, multiplyByThree, addTwo);

console.log(calculate(5));
❀5πŸ”₯3πŸ‘1
❀4πŸ€”3πŸ‘2
😏 CSS conditionals with the new if() function

From Chrome 137 you can try out CSS inline conditionals with the if() function. if() enables a cleaner developer interface for dynamic styles like style queries and media queries, with some key differences, which you can learn about in this post.
Please open Telegram to view this post
VIEW IN TELEGRAM
❀10πŸ‘3πŸ”₯2
CHALLENGE

function Vehicle(wheels) {
this.wheels = wheels;
}

Vehicle.prototype.getWheels = function() {
return this.wheels;
};

function Car() {
Vehicle.call(this, 4);
this.doors = 4;
}

Car.prototype = Object.create(Vehicle.prototype);
Car.prototype.constructor = Car;

const myCar = new Car();
console.log(myCar.getWheels(), myCar instanceof Vehicle);
❀4
❀4πŸ”₯3πŸ€”3πŸ‘1
✌️ The Nginx HTTP server has a module (njs) for extending its functionality using JavaScript, but it only supported ES5. Now, njs uses QuickJS for a more modern, powerful experience with full ES2023 support.
Please open Telegram to view this post
VIEW IN TELEGRAM
❀5πŸ”₯3πŸ‘2
CHALLENGE

function getOrder() {
console.log('1');

setTimeout(() => console.log('2'), 0);

Promise.resolve().then(() => {
console.log('3');
Promise.resolve().then(() => console.log('4'));
});

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

console.log('6');
}

getOrder();
❀3
πŸ‘7❀4πŸ”₯3
🎹 A collection of JavaScript tools written in Rust.

The Oxidation Compiler is creating a collection of high-performance tools for JavaScript and TypeScript.
Please open Telegram to view this post
VIEW IN TELEGRAM
❀5πŸ€”2πŸ‘1πŸ”₯1
CHALLENGE

const scores = [85, 92, 78, 90];  
const student = {
name: 'Jordan',
grade: 'A',
...{ courses: ['Math', 'Science'] },
scores,
average: function() { return this.scores.reduce((a, b) => a + b) / this.scores.length }
};

const { name, ...details } = student;
const [first, ...rest] = scores;

console.log(details.scores[0], rest[0]);
❀4πŸ”₯1
πŸ”₯3πŸ‘2❀1πŸ€”1
CHALLENGE

function* createCounter() {
let count = 0;
while (true) {
const reset = yield ++count;
if (reset) {
count = 0;
}
}
}

const counter = createCounter();
console.log(counter.next().value);
console.log(counter.next().value);
console.log(counter.next(true).value);
console.log(counter.next().value);
❀9πŸ‘1
πŸ‘3
CHALLENGE

function createCounter() {
let count = 0;

const counter = {
increment() {
count++;
return count;
},
getCount() {
return count;
}
};

return counter;
}

let c1 = createCounter();
c1.increment();
c1.increment();

let c2 = c1;
c1 = null;

console.log(c2.getCount());
❀3πŸ‘1
πŸ‘5πŸ€”5❀1