FindArrayMinimum

Description

The FindArrayMinimum method finds the index of the minimum value in a numeric array within a specified range.

Syntax

public FindArrayMinimum(array: number[], count: number = this.api.APIConstants.ARRAY_ENTIRE, start = 0): number

Parameters

  • array: An array of numbers to search in

  • count: Optional. The number of elements to search through. Default is ARRAY_ENTIRE

  • start: Optional. The starting index for the search. Default is 0

Return Value

Returns a number representing the index of the minimum value in the specified range. Returns -1 if the range is invalid.

Example

const prices = [10.5, 11.2, 10.8, 11.5, 10.9];
const minIndex = this.api.FindArrayMinimum(prices);
console.log(`Minimum price ${prices[minIndex]} found at index ${minIndex}`);

// Search in a specific range
const rangeMinIndex = this.api.FindArrayMinimum(prices, 3, 1); // Search 3 elements starting from index 1

Last updated