Skip to content

Find First Match

What It Does

Searches through a list of numbers to find the first item that satisfies a specified comparison with a target value. It can find values greater than or less than a specified number and returns both the matching value and its position.

Inputs

NameDescriptionTypeRequired
arrayThe list of numbers to search throughListYes
targetThe comparison value to test againstNumberYes
operatorThe comparison type (">" for greater than or "<" for less than)TextNo

Outputs

NameDescriptionType
valueThe first matching value found (undefined if none found)Number
indexThe position of the matching value in the array (-1 if none found)Number
foundWhether a matching value was foundYes/No

Find First Match Example

How to Use It

  1. Drag the Find First Match node into your graph.
  2. Connect an array of numbers (like [5, 10, 15, 20]) to the "array" input.
  3. Set a target number (like 12) to the "target" input.
  4. Choose an operator (like > to find values greater than the target).
  5. Run the graph—with the example inputs, your output will be: value: 15, index: 2, found: true.

Tips

  • Always check the "found" output before using the value, as it may be undefined if no match was found.
  • The search stops at the first matching item, even if multiple items would match.

See Also

  • Array Find: For more complex finding conditions using an inner graph.
  • Array Filter: For getting all items that match a condition instead of just the first.

Use Cases

  • Threshold Detection: Find the first value that exceeds a minimum threshold.
  • Breakpoint Identification: Locate the first screen width breakpoint that's smaller than the current viewport.
  • Financial Analysis: Find the first data point where a value crosses above or below a critical level.