Javascript Tutorial - Array Filter

preview_player
Показать описание

In the example we take an array of numbers and remove all the odd numbers, keeping the even numbers.

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

You can check for odd numbers with 'return n%2 == 1' instead of 'return !(n%2 == 0)'.

ubermensch-mne
Автор

Nice, correct me if I'm wrong, but doing this does NOT change the original "numbers" array right.

harag