Похожие чаты

There’s a specific built-in method called filter. const array = [1,

2, 10, 16];

const filterArray = array.filter(num => num > 5);

console.log(filterArray);

Why did they build this build-in method filter when you can just use a function that can just iterates numbers you can just select on the conditional line?

8 ответов

19 просмотров

why did they create switch statements when you can have multiple if statements.

Charlemagne-Holdt Автор вопроса
Ghazwan Aliesh
why did they create switch statements when you can...

Yeah, the same goes for map and reduce as well… when you can just use a function and make whatever conditon you wanna put in in the conditional block.

Charlemagne Holdt
Yeah, the same goes for map and reduce as well… wh...

But using these functions is much more powerful than interating. For example, you can chain multiple map, filter .. etc.

Why did they add numbers to JS when you can just invent your own numbers using church encoding (functions) or strings?

Charlemagne-Holdt Автор вопроса
Thomas
Why did they add numbers to JS when you can just i...

The cause and effect worldview vs Teleological worldview

Charlemagne Holdt
The cause and effect worldview vs Teleological wor...

filter was added because Brendan thought it was a good idea to add it

Charlemagne-Holdt Автор вопроса
Thomas
filter was added because Brendan thought it was a ...

The ones who believe in Teleological worldview would ask, then why did God add Brenden to this world? ;)

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта