D3.js leastIndex() Method Last Updated : 23 Sep, 2020 Comments Improve Suggest changes Like Article Like Report With the help of d3.leastIndex() method, we can get the index of least value from the sequence of numbers in an array by using this method. Syntax: d3.leastIndex( iterable ) Parameter: This function has the following parameter as mentioned above and described below: iterable: Insert any kind of iterable object. Return Value: It return the index of least value. Note: To execute the below examples, you have to install the d3 library by using this command prompt we have to execute the following command. npm install d3 Example 1: In this example, we can see that by using d3.leastIndex() method, we are able to get the index of least value from the sequence from an array by using this method. Filename: index.js javascript // Defining d3 variable var d3 = require('d3'); var gfg = d3.leastIndex([42, 12, 34, 21]) console.log(gfg) Output: 1 Example 2: Filename: index.js javascript // Defining d3 variable var d3 = require('d3'); var arr = [] for(var i = 0; i < 5; i++) { arr.push(i * 2); } var gfg = d3.leastIndex(arr) console.log(gfg) Output: 0 Note: The above program will compile and run by using the following command: node index.js Reference:https://github.com/d3/d3-array/blob/master/README.md Comment More infoAdvertise with us Next Article D3.js leastIndex() Method J jitender_1998 Follow Improve Article Tags : JavaScript Web Technologies D3.js D3.js Array Similar Reads D3.js least() Method With the help of d3.least() method, we can get the least value from the sequence of numbers in an array by using this method. Syntax: d3.least(iterable) Parameter: This function has the following parameter as mentioned above and described below: iterable: Insert any kind of iterable object. Return V 1 min read D3.js maxIndex() Method With the help of d3.maxIndex() method, we can get the index of value which is found to be maximum in an array of numbers, strings or dates. We can use any kind of array we just got the index of maximum value by using this method. Syntax: d3.maxIndex( iterable ) Parameter: This function has the follo 2 min read D3.js greatestIndex() Method With the help of d3.greatestIndex() method, we can get the index of the largest value from the sequence of numbers in an array by using this method. Syntax: d3.greatestIndex( iterable, accessor ) Return value: It returns the index of the largest value. Note: To execute the below examples you have to 1 min read JavaScript Array lastIndexOf() Method The JavaScript Array lastIndexOf() Method is used to find the index of the last occurrence of the search element provided as the argument to the function.Syntax: array.lastIndexOf(element, start)Parameters: This method accepts two parameters as mentioned above and described below: element: This para 3 min read Lodash _.lastIndexOf() Method Lodash _.lastIndexOf() method is like the _.indexOf method except that it iterates over elements of an array from right to left.Syntax:_.lastIndexOf(array, value, [fromIndex=array.length-1]);Note: If the value is not found in the array -1 is returned.Parameters: array: It is the array in which value 3 min read Like