const words = ['apple', 'banana', 'cherry'];
const result = words.flatMap(word => word.split('').reverse());
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π2
What is the output?
Anonymous Quiz
6%
['e', 'l', 'p', 'a', 'n', 'a', 'b', 'h', 'c']
5%
['e', 'l', 'p', 'a', 'n', 'a', 'b', 'h', 'c']
43%
['elppa', 'ananab', 'yrrehc']
46%
['e', 'l', 'p', 'p', 'a', 'e', 'n', 'a', 'n', 'a', 'b', 'h', 'c', 'e', 'r', 'r', 'y']
π18π€©6π€5π€£4β€3
If you want to control a headless Chrome browser from Node, Puppeteer is for you. Now we just need a Playwright one as well ;-)
MOHAN GANESAN
Please open Telegram to view this post
VIEW IN TELEGRAM
π11π₯3β€1
const items = [1, 2, 3, 4, 5];
const result = items.reduce((acc, val) => acc.concat(Array.from({ length: val }, () => val)), []);
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€6π4π€©3
What is the output?
Anonymous Quiz
15%
[1, 1, 2, 2, 3, 3, 4, 4, 5, 5]
29%
[1, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]
21%
[1, 2, 3, 4, 5]
35%
[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]
π14π₯6π€©2π€1
1. You are reading dozens of the best Node.js articles - this repository is a summary and curation of the top-ranked content on Node.js best practices, as well as content written here by collaborators
2. It is the largest compilation
3. Best practices have additional info
YONI GOLDBERG ET AL.
Please open Telegram to view this post
VIEW IN TELEGRAM
π11β€3π€©2π₯1
const words = ['apple', 'banana', 'cherry'];
const result = words.map(word => word.split('').sort().join(''));
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€3
What is the output?
Anonymous Quiz
19%
['a', 'b', 'c']
13%
['elppa', 'banana', 'cherry']
18%
['elppa', 'ananab', 'yrrehc']
50%
["aelpp", "aaabnn", "cehrry"]
π17π€7β€5π€©2
Please open Telegram to view this post
VIEW IN TELEGRAM
π€£99π12π₯3π€3 1
const data = [
{ id: 1, name: 'Alice', age: 25, gender: 'Female' },
{ id: 2, name: 'Bob', age: 30, gender: 'Male' },
{ id: 3, name: 'Charlie', age: 22, gender: 'Male' },
{ id: 4, name: 'David', age: 35, gender: 'Male' },
];
const result = data
.filter(person => person.gender === 'Male')
.map(person => ({ ...person, isSenior: person.age > 30 }))
.sort((a, b) => a.age - b.age)
.slice(0, 2)
.reduce((acc, person) => {
acc[person.name] = person.isSenior;
return acc;
}, {});
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€5π3π€3
What is the output?
Anonymous Quiz
22%
{ Charlie: false, David: true }
27%
{ Bob: false, Charlie: false }
33%
{ David: true, Bob: false }
17%
{ Bob: false, David: true }
π€20π₯7π5β€2 1
πͺ The Await Event Horizon in JavaScript
You know someoneβs getting heavy when they start a JavaScript article by talking about the event horizon around black holes and how βa similar boundary exists around every JavaScript Promise.β Enjoy.
CHARLES LOWELL
You know someoneβs getting heavy when they start a JavaScript article by talking about the event horizon around black holes and how βa similar boundary exists around every JavaScript Promise.β Enjoy.
CHARLES LOWELL
π₯7β€5π5
const data = [1, 2, 3, 4, 5];
const result = data.map(num => Array.from({ length: num }, (_, index) => index + 1));
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π3β€1
What is the output
Anonymous Quiz
23%
[[1], [2, 1], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5]]
21%
[[1], [2], [3], [4], [5]]
12%
[[1], [2], [3], [4], [5], [6]]
43%
[[1], [1, 2], [1, 2, 3], [1, 2, 3, 4], [1, 2, 3, 4, 5]]
β€7π₯7π5π€4
This is gorgeous! You can have a lot of fun adjusting the parameters to change the outcome, or you can spin up and play with your own copy using the source code. If you donβt want to stress out your browser, you can see how it looks βΆοΈ in this video.
DANIEL GREENHECK
Please open Telegram to view this post
VIEW IN TELEGRAM
π₯5β€4π4
const data = [1, 2, 3, 4, 5];
const result = data.flatMap(num => Array.from({ length: num * 2 - 1 }, (_, index) => index % 2 === 0 ? num : index + 1));
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€5π2
What is the output?
Anonymous Quiz
48%
[1, 2, 2, 2, 3, 2, 3, 4, 3, 4, 2, 4, 4, 4, 6, 4, 5, 2, 5, 4, 5, 6, 5, 8, 5]
19%
[1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 8, 9]
20%
[1, 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9]
13%
[1, 2, 3, 4, 5, 6, 7, 8, 9]
π8π€4β€2π₯2π€©1
βJust because you know something needs JavaScript, doesnβt mean it still does. You can make better websites if you test those assumptions every now and then.β
KILLIAN VALKHOF
Please open Telegram to view this post
VIEW IN TELEGRAM
β€9π4π₯2π€£2
P.S. Dear premium Telegram users, this Christmas, the gift is in your hands! Boost us on Telegram for free, and your support becomes the festive present to all of us (it enables features like stories and more).
Please open Telegram to view this post
VIEW IN TELEGRAM
β€30π5π₯4π€©3 3π€£2