JavaScript
33K subscribers
1.14K photos
10 videos
33 files
814 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
👍53🤔3🔥1
Merry Christmas 🎄
Please open Telegram to view this post
VIEW IN TELEGRAM
58👍14🔥5🤔2
CHALLENGE

const numbers = [1, 2, 3, 4, 5];
const result = numbers
.filter(n => n % 2 === 0)
.map(n => n * 2)
.reduce((acc, curr) => acc + curr, 0);

const original = numbers.slice();
numbers.splice(2, 1, 99);

console.log(result);
console.log(numbers);
console.log(original);
4🔥2👍1🤣1
Please open Telegram to view this post
VIEW IN TELEGRAM
👍62
CHALLENGE

const getValue = (x) => {
console.log(`Getting: ${x}`);
return x;
};

const obj = { name: null };

const result = obj.name || getValue('default') && getValue('final');
console.log(`Result: ${result}`);
👍5🔥2
✌️ The JavaScript Bundler Grand Prix

Bundlers now sit at the heart of many JavaScript workflows and are sometimes even integrated into runtimes (e.g. Bun’s). This piece surveys the landscape and argues the speed wars are mostly over, with the real battle shifting to artifact size and the code that actually ships to users.

Kate Holterhoff
Please open Telegram to view this post
VIEW IN TELEGRAM
👍54🔥1
CHALLENGE

function createCounter() {
let count = 0;
return function(increment = 1) {
count += increment;
return count;
};
}

const counter1 = createCounter();
const counter2 = createCounter();

console.log(counter1());
console.log(counter1(5));
console.log(counter2(3));
console.log(counter1());
console.log(counter2());
4👍1🔥1
🔥11👍2
Runtime of the year 🤔
Please open Telegram to view this post
VIEW IN TELEGRAM
3
Your favourite runtime of the year?
Anonymous Poll
81%
Node.js 🌲
5%
Deno 💻
7%
Bun 🌟
6%
Other 🤔
👍73🔥2
Framework/lib of the year 🤔
Please open Telegram to view this post
VIEW IN TELEGRAM
9🤔4👍1
Your favourite framework/lib of the year
Anonymous Poll
65%
React 🔵
9%
Angular 📸
4%
Svelte 🟠
9%
Vue.js 🌲
12%
Next.js
🤣106👍1
Happy New Year! 🎄 🍾

Wishing you fewer meetings, more merges, and no Friday deploys. 😆

@JavaScript Telegram Newsletter Team
Please open Telegram to view this post
VIEW IN TELEGRAM
33👍6🔥4
CHALLENGE

class Vehicle {
#engine = 'V6';
static count = 0;

constructor(type) {
this.type = type;
Vehicle.count++;
}

static getCount() {
return this.count;
}

get info() {
return `${this.type} with ${this.#engine}`;
}
}

class Car extends Vehicle {
static count = 0;

constructor(brand) {
super('car');
this.brand = brand;
Car.count++;
}
}

const tesla = new Car('Tesla');
const ford = new Car('Ford');
console.log(Vehicle.getCount());
console.log(Car.getCount());
console.log(tesla.info);
3👍2🔥1
8👍2
CHALLENGE

async function fetchData() {
return Promise.resolve('data');
}

async function processData() {
console.log('start');
const result = fetchData();
console.log(typeof result);
const data = await fetchData();
console.log(typeof data);
console.log('end');
}

processData();
8
CHALLENGE

function* fibonacci() {
let a = 0, b = 1;
yield a;
yield b;
while (true) {
let next = a + b;
yield next;
a = b;
b = next;
}
}

const gen = fibonacci();
const results = [];
for (let i = 0; i < 6; i++) {
results.push(gen.next().value);
}
console.log(results.join(','));
4👍1🤔1