Skip to main content

Max Array

This node finds the maximum value in an array.

The Max Array node scans an array to find the largest element.

The Max Array node takes an array as input and returns the maximum value found within it. It supports arrays of numbers (finding the largest number), strings (finding the last alphabetical value), and objects (using a key path).

Inputs

Input

DataDescription
ArrayThe array to scan. Can contain numbers, strings, or objects.

Object Options

DataDescription
Key PathRequired if the array contains objects. Specifies the property path to compare (e.g., "score").

Actions

SignalDescription
DoTriggers the calculation. The result is updated only when this signal is received.

Outputs

Data

DataDescription
MaximumThe largest value found in the array.

Signals

SignalDescription
DoneTriggered when the calculation is successfully completed.

Usage

Use this node to find peaks, high scores, or sorting boundaries.

Example Use Cases

  1. High Score: Find the highest score in a list of player objects.
    • Array: Players.
    • Key Path: "stats.highScore".
  2. Data Analysis: Find the peak value in a dataset of numbers.
  3. Alphabetical Sort: Find the "last" word in a list (e.g., "Zebra" > "Apple").

Detailed Behavior

  1. Numeric Arrays: Uses Math.max() logic.
  2. String Arrays: Sorts alphabetically and returns the last item.
  3. Object Arrays: Extracts values using Key Path before comparing.
  4. Empty Array: Returns 0 if the array is empty.

Troubleshooting

  • Incorrect Max: Ensure your data types are consistent. Comparing numbers and strings can yield unexpected results.