Skip to main content

FILTER

Filters an array of objects based on specified criteria.

Syntax

FILTER(array, criteria)

Arguments

  • array: The array of objects to filter.
  • criteria: The condition used to match items. This can be:
    • An object: { key: value } to match items where the property equals the value.

Examples

// Example array
const data = [
{ name: "name1", del: 20 },
{ name: "name2", del: 30 },
{ name: "name1", del: 40 }
]

// Match object shorthand
FILTER(data, { name: "name1" })
// → [ { name: "name1", del: 20 }, { name: "name1", del: 40 } ]

// → [ { name: "name2", del: 30 }, { name: "name1", del: 40 } ]
Use FILTER when you want to return all items in an array that meet certain conditions.
For only the first matching item, use FIND instead.