# filter method to filter an array in JavaScript

`filter`

Given an array of numbers. Leave only positive numbers in it.

Given an array of numbers. Leave only negative numbers in it.

Given an array of numbers. Leave in it only numbers that are greater than zero, but less than `10`.

Given an array with strings. Leave in it only those strings whose length is more than `5` characters.

Given an array of numbers. Leave in it only those numbers whose product of their values and index numbers is less than `30`.

An array is given, it can contain ordinary elements and subarrays, for example [1, `2`, [3, 4], `5`, [6, 7]]. Leave only ordinary elements in it.

←→
↑
en ru