consta = [1,2,3,4] // default behavior: maxOfArray(a,"") // => 4 // if no data present at the path the default value is used: maxOfArray(a,"a",1) // => 1
consta = [{value:1},{value:2},{value:3},{value:4}] // default behavior: maxOfArray(a,"value") // => 4 // if no data present at the path the default value is used: maxOfArray(a,"a",1) // => 1
Returns
Parameters
arr: any[]
The array
path: string
The path to the data.
OptionaldefaultValue: number = 0
if no data present at the path the default value is used.
Helper to determine the maximum of an array
Example 1:
Example 2:
Returns