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).
| Data | Description |
|---|
| Array | The array to scan. Can contain numbers, strings, or objects. |
Object Options
| Data | Description |
|---|
| Key Path | Required if the array contains objects. Specifies the property path to compare (e.g., "score"). |
Actions
| Signal | Description |
|---|
| Do | Triggers the calculation. The result is updated only when this signal is received. |
Outputs
Data
| Data | Description |
|---|
| Maximum | The largest value found in the array. |
Signals
| Signal | Description |
|---|
| Done | Triggered when the calculation is successfully completed. |
Usage
Use this node to find peaks, high scores, or sorting boundaries.
Example Use Cases
- High Score: Find the highest score in a list of player objects.
Array: Players.
Key Path: "stats.highScore".
- Data Analysis: Find the peak value in a dataset of numbers.
- Alphabetical Sort: Find the "last" word in a list (e.g., "Zebra" > "Apple").
Detailed Behavior
- Numeric Arrays: Uses
Math.max() logic.
- String Arrays: Sorts alphabetically and returns the last item.
- Object Arrays: Extracts values using
Key Path before comparing.
- 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.