Похожие чаты

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 ответов

4 просмотра

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? ;)

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

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

I arrived here after a Chico Crypto show highlighted the project & the Team - the fact that the Team had a long history of successfully working with household names gave me e...
Banter is Bullish
1
Привет всем. появился вопрос. Разрабатываю сайт, в данный момент он запущен. Хостинг beget. Добавляю на сайт яндекс метрику с помощью полей client-settings (взято отсюда http...
Andrew
2
Почему у макбука экран не сенсорный?
✨ Anatolii Cherednichenko
28
я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
а как ловят такое ghci> res <- getPos2 urlt 0 (alist !! 0) 200 ghci> res SearchAtom (Search "www.google.com" "/search?q=" "Haskell") "haskell.org" (SearchTS [(2024-05-06 07:...
Fedor
14
Is it a good price to buy hex now on 0,0019?
Patrick
29
короче сгенерила мне эта штука код на ассемблере: struc string val { common local .value dq .value .value: if ~val eq db val end if db 0 } fo...
Vi Chapmann Chapmann
12
Есть тут те у кого дети есть + 2 работы + в зал ходят + в семейной жизни все хорошо?
Abdul-Aziz M.
13
Я пожалуй ещё раз брошу клич: кто-нибудь хочет в рабство в ОЭЗ Алабугу на позицию инженера CV? Работы много, задачи сложные, ЗП высокая. Я передам контакт напрямую в HR.
Maxim 👀 Osminin #Slowpoke3D
13
Всем привет! Массив вводится с клавиатуры, кол-во элементов неизвестно, поэтому я указал arr db 100 dup(?) С нахождением максимума проблем нет, а вот минимум почему-то всегд...
En Vind Av Sorg
11
Карта сайта