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
โค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
โค6๐Ÿค”3๐Ÿคฃ2
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
โค3๐Ÿค”3๐Ÿ‘1๐Ÿ”ฅ1
CHALLENGE

const user = {
name: 'Sarah',
age: 28,
getName() {
return this.name;
}
};

const { getName } = user;
const boundGetName = user.getName.bind(user);

console.log(getName());
console.log(boundGetName());
console.log(user.getName());
โค5๐Ÿค”2
๐Ÿ‘8โค1๐Ÿค”1
CHALLENGE

function* outer() {
yield 1;
yield* inner();
yield 4;
}

function* inner() {
yield 2;
yield 3;
}

const gen = outer();
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next().value);
console.log(gen.next().value);
๐Ÿ”ฅ3โค1๐Ÿ‘1
โค3๐Ÿค”3๐Ÿคฉ1
CHALLENGE

const obj = { a: 1, b: 2, c: 3 };
const entries = Object.entries(obj);
const keys = Object.keys(obj);
const values = Object.values(obj);

const result = {
entriesLength: entries.length,
keysJoined: keys.join('-'),
valuesSum: values.reduce((sum, val) => sum + val, 0),
firstEntry: entries[0]
};

console.log(result.entriesLength);
console.log(result.keysJoined);
console.log(result.valuesSum);
console.log(result.firstEntry);
โค1๐Ÿ”ฅ1
๐Ÿ‘8๐Ÿค”4โค3๐Ÿคฃ2๐Ÿ”ฅ1
๐Ÿ˜ฎ The 2025 JavaScript Rising Stars

At the start of each year, Michael rounds up the projects in the JavaScript ecosystem that gained the most popularity on GitHub in the prior year. After a two-year run of topping the chart, shadcn/ui has been pushed down to #3 by n8n and React Bits. This is a fantastic roundup, now in its tenth(!) year, and features commentary from a few industry experts too.

Michael Rambeau et al.
Please open Telegram to view this post
VIEW IN TELEGRAM
โค6๐Ÿ‘3๐Ÿ”ฅ3
CHALLENGE

const config = { api: 'v1', timeout: 5000 };
Object.seal(config);

const settings = { theme: 'dark', lang: 'en' };
Object.freeze(settings);

config.api = 'v2';
config.retries = 3;
settings.theme = 'light';
settings.debug = true;

console.log(config.api);
console.log(config.retries);
console.log(settings.theme);
console.log(settings.debug);
๐Ÿ‘4๐Ÿ”ฅ2
๐Ÿ‘5๐Ÿ”ฅ3โค2
โœŒ๏ธ๐ŸŒฒ๐Ÿ“ธ๐ŸŸ ๐Ÿ”ต Schedule-X 3.6: A Material Design Calendar and Date Picker

Available in the form of React/Preact, Vue, Svelte, Angular, or plain JS components. Open source but with a premium version with extra features. GitHub repo.

Tom ร–sterlund
Please open Telegram to view this post
VIEW IN TELEGRAM
โค8๐Ÿ”ฅ3๐Ÿ‘1
CHALLENGE

console.log(typeof myVar);
console.log(typeof myFunc);
console.log(typeof myArrow);

var myVar = 'initialized';

function myFunc() {
return 'function declaration';
}

var myArrow = () => 'arrow function';

console.log(typeof myVar);
console.log(typeof myFunc);
console.log(typeof myArrow);
โค3๐Ÿ‘2๐Ÿ”ฅ1
๐Ÿ‘€ For years, Mozilla, Apple, and the CSS Working Group have been working to bring "masonry" layouts (as above) natively to CSS. The concept is now called CSS Grid Lanes and here's how it works. You can already try it out in Safari Technology Preview 234.
Please open Telegram to view this post
VIEW IN TELEGRAM
โค5๐Ÿ‘3๐Ÿ”ฅ3
CHALLENGE

const data = [
{ type: 'income', amount: 1000, category: 'salary' },
{ type: 'expense', amount: 200, category: 'food' },
{ type: 'income', amount: 500, category: 'freelance' },
{ type: 'expense', amount: 150, category: 'transport' }
];

const result = data.reduce((acc, item) => {
const key = item.type;
acc[key] = (acc[key] || 0) + item.amount;
return acc;
}, {});

console.log(result.income - result.expense);
๐Ÿ‘4โค3๐Ÿ”ฅ1
What is the output?
Anonymous Quiz
24%
undefined
54%
1150
18%
1500
4%
350
๐Ÿ”ฅ6โค5๐Ÿ‘1