Description
Loops through each item in the passed array and returns the item whose value is closest to specified value without going over.
Input Parameters
Name | Type | Required | Description |
---|---|---|---|
array | Any | Yes | Array of Json objects |
attribute | Text | Yes | Property name whose value will be compared to the specified value |
value | Number | Yes | Numeric value that each item is being compared to |
Returns
Type: Any
Returns the Json object from the passed array whose value (at the specified attribute) was closest to the specified value.
Examples
Remarks
Use this function when you have an array of Json objects and you want to find a particular object based on a numeric value comparison with a property common to all objects in the array.