JavaScript filter Array Method in Depth

preview_player
Показать описание
In JavaScript, the filter() function is used to filter out the items from an array based on a condition provided as input in the form of a predicate. This function is defined as a method on the Array object so that it can be invoked from any array.

Predicates can be used to define conditions for the filtering process. We use predicates to decide whether or not to keep each item in or not.

Functional programming is a programming paradigm in which you build programs by composing functions. The computation is then the evaluation of those functions. Functional programming focuses on the usage of pure functions and on avoiding shared, mutable state. This programming paradigm is declarative. Functional code is usually more concise and easier to test.

In this mini series, we will embark on an exciting journey to learn a bit about functional programming by using JavaScript. Presented concepts will be mostly universal and applicable to other programming languages. This series is created with beginners and non-programmers in mind; don't worry, we will take it slowly!

#functional #javascript #filter
Рекомендации по теме
Комментарии
Автор

This is the best explanation I have found on youtube for higher order functions and the filter function. Very glad you made this series and it deserves a lot more views.

akhtarandroid
Автор

Thanks for that content, it was very useful to me. thx

Aziz-kwct
Автор

Sir what a awesome video on Filter array method i never seen like that video on filters

kimse
Автор

for logging array, I'd like to use console.table(result) rather than console.log(result);

AndySongCode
Автор

What are you using to run this code, can I do this as easily in vscode?

brokenoho
Автор


    const result = [];


    for (let item of this) {
      if (predicate(item)) {
        result.push(item);
      }
    }
    return result;
  };



//I think we can also have our own filter implementation.

AndySongCode
visit shbcf.ru