Javascript array filter by object property

Опубликовано: 14 Октябрь 2024
на канале: Samovar tutorials
535
6

Array of objects filtered by property

How to select objects from an array by object property.
For example, we need to select employees of the sales department from the general list of employees.
So, we have a general list of employees.
Different names, different departments.
We only need a sales department.
Let's use the "filter" method.
Let's compare the "department" property of the object with the name of the department.
So we got it.