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
if (false) {
function foo() {
return 1;
}
}
console.log(foo());
Please open Telegram to view this post
VIEW IN TELEGRAM
π12β€1
Erick Wendel
Please open Telegram to view this post
VIEW IN TELEGRAM
π13 4β€3
const numbers = [2, 4, 6, 8, 10];
const result = numbers.reduce((acc, val) => {
acc[val] = val * 2;
return acc;
}, {});
console.log(result);
Please open Telegram to view this post
VIEW IN TELEGRAM
β€6π1
What is the output?
Anonymous Quiz
19%
{ 2: 4, 4: 8, 6: 12, 8: 16, 10: 10 }
51%
{ 2: 4, 4: 8, 6: 12, 8: 16, 10: 20 }
10%
{ 2: 4, 4: 8, 6: 12, 8: 16 }
20%
{ 4: 8, 8: 16, 12: 24, 16: 32, 20: 40 }
Please open Telegram to view this post
VIEW IN TELEGRAM
What are your favorite frontend frameworks?
Anonymous Poll
76%
React
17%
Angular
14%
Vue.js
5%
Svelte
3%
Astro
20%
Next.js
3%
Remix
6%
htmx
Guess what? We've hit 7,000 members! π₯³
We thought this milestone was a next-year thing, but thanks to all of you, we're celebrating it right now.βΊοΈ
Whether you've been with us from the start or just joined, your presence is what makes our community awesome.π
We thought this milestone was a next-year thing, but thanks to all of you, we're celebrating it right now.
Whether you've been with us from the start or just joined, your presence is what makes our community awesome.
Please open Telegram to view this post
VIEW IN TELEGRAM
β€14 8π5π€1
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
What are your favorite database?
Anonymous Poll
21%
PostgreSQL
59%
MySQL
8%
SQLite
4%
Redis
39%
MongoDB
2%
Cassandra
1%
Elasticsearch
4%
MariaDB
2%
DynamoDB
2%
Neo4j
Please open Telegram to view this post
VIEW IN TELEGRAM