const data = [
{ id: 1, name: 'Alice', skills: ['JavaScript', 'HTML'] },
{ id: 2, name: 'Bob', skills: ['JavaScript', 'CSS'] },
{ id: 3, name: 'Charlie', skills: ['HTML', 'CSS'] },
];
const result = data.reduce((acc, person) => {
person.skills.forEach(skill => {
acc[skill] = acc[skill] ? acc[skill] + 1 : 1;
});
return acc;
}, {});
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π23
What is the output?
Anonymous Quiz
24%
{ JavaScript: 3, HTML: 2, CSS: 2 }
20%
{ JavaScript: 3, HTML: 1, CSS: 1 }
14%
{ JavaScript: 2, HTML: 1, CSS: 1 }
42%
{ JavaScript: 2, HTML: 2, CSS: 2 }
If youβve ever gone into
node_modules and been overwhelmed, this tool, supporting both npm and Yarn, lets you dig around with some guidance as to what is what. You can use fuzzy search to find specific things and also see which modules are using the most space.RAN YITZHAKI
Please open Telegram to view this post
VIEW IN TELEGRAM
π5π€©3β€2 1
const data = [1, 2, 3, 4, 5];
const result = data.reduce((acc, val) => acc.concat(Array.from({ length: val }, (_, index) => val + index)), []);
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π6 2β€1π€1
What is the output?
Anonymous Quiz
32%
[1, 2, 2, 3, 3, 4, 5, 5, 5, 6, 7, 7, 8, 9, 9]
27%
[1, 2, 3, 4, 5, 6, 7, 8, 9]
31%
[1, 2, 3, 3, 4, 5, 4, 5, 6, 7, 5, 6, 7, 8, 9]
11%
[1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 8, 9]
π15π€8β€4
π₯ Why I donβt burnout and still love programming
Youβre facing a 10-day deadline, and you end up procrastinating for the first 8 days because you just didnβt have the mood to work. However, you managed to complete the task ...
"My Story of Beating Burnout and Loving Programming"
Nairi
Youβre facing a 10-day deadline, and you end up procrastinating for the first 8 days because you just didnβt have the mood to work. However, you managed to complete the task ...
"My Story of Beating Burnout and Loving Programming"
Nairi
β€11π7 3
const data = [1, 2, 3, 4, 5];
const result = data.flatMap(num => Array(num).fill(num * 2));
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π4
What is the output?
Anonymous Quiz
20%
[1, 1, 2, 2, 3, 3, 4, 4, 5, 5]
10%
[1, 2, 3, 4, 5]
20%
[1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5]
50%
[2, 4, 4, 6, 6, 6, 8, 8, 8, 8, 10, 10, 10, 10, 10]
Check out our awesome emoji pack βοΈ
βοΈ
π π΅
π€ π² π π»
π² π π π π΅
π π π π₯ π΄ π¦
π π π π π π π
β¦
β‘οΈ Boost us in Telegram.
β¦
Please open Telegram to view this post
VIEW IN TELEGRAM
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.age).reduce((acc, age) => acc + age, 0);
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π8β€4 2
π22 17β€4π€£4
This repository is a compilation of well-written, step-by-step guides for re-creating our favorite technologies from scratch.
codecrafters-io
Please open Telegram to view this post
VIEW IN TELEGRAM
π12β€4 3
const numbers = [1, 2, 3, 4, 5];
const result = numbers.reduce((acc, num) => {
if (num % 2 === 0) {
acc.even += num;
} else {
acc.odd *= num;
}
return acc;
}, { even: 0, odd: 1 });
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
π11β€1
What is the output?
Anonymous Quiz
64%
{ even: 6, odd: 15 }
17%
{ even: 9, odd: 120 }
13%
{ even: 6, odd: 120 }
6%
{ even: 9, odd: 15 }
Vue 2 went βend of lifeβ last week, but never fear, we got a new version of Vue 3 to make up for it, complete with a rewritten, faster template parser, and a more efficient reactivity system. If you prefer a screencast tour, βΆοΈ Erik Hanchett has one for you.
EVAN YOU
Please open Telegram to view this post
VIEW IN TELEGRAM
In the modern IT industry, Java and JavaScript stand as leading programming languages for building scalable and reliable software systems. They offer flexibility and automation capabilities for implementing business rules.
Gnel Simonyan
Please open Telegram to view this post
VIEW IN TELEGRAM
CHALLENGE
const words = ['apple', 'banana', 'cherry'];
const result = words.map(word => [...word].reduce((acc, char) => char + acc, ''));
console.log(result);
π15 3β€2
What is the otuput?
Anonymous Quiz
62%
["elppa", "ananab", "yrrehc"]
14%
['epple', 'ananab', 'rehtc']
13%
['elppa', 'ananab', 'rehtc']
12%
['epple', 'ananab', 'yrrehc']
π22 4β€3
Famously roasted in JavaScript: The Good Parts before its deprecation, with isnβt a popular language feature at all, so Alex's appeal here is partly tongue in cheek. Nonetheless, with has some potentially interesting uses in modern JavaScript.
ALEX MACARTHUR
Please open Telegram to view this post
VIEW IN TELEGRAM
function Car(make, model) {
this.make = make;
this.model = model;
}
Car.prototype.displayInfo = function () {
return `Make: ${this.make}, Model: ${this.model}`;
};
const myCar = new Car('Toyota', 'Camry');
console.log(myCar.displayInfo());
Please open Telegram to view this post
VIEW IN TELEGRAM
π4β€1
What is the output?
Anonymous Quiz
15%
[object Object]
74%
Make: Toyota, Model: Camry
7%
Undefined
5%
This will result in an error.
β€17π6 4