--- title: "findByScale" slug: "tools-findbyscale" updated: 2025-11-06T19:00:58Z published: 2025-11-06T19:00:58Z canonical: "docs.doc-know.com/tools-findbyscale" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.doc-know.com/llms.txt > Use this file to discover all available pages before exploring further. # findByScale ### tools.findByScale Loops through each item in the passed array and returns the item whose value is closest to a 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 ``` var items = [ { "age": 10, "name": "Ethan" }, { "age": 20, "name": "Annabelle" }, { "age": 30, "name": "Grant" }, { "age": 40, "name": "Terri" }, { "age": 50, "name": "Ben" } ]; // find the item in the array whose 'age' is closest to 25 without going over // note: the entire object for 'Annabelle' is returned var item = tools.findByScale(items, "age", 25); ``` ### 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.