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.
d3.maxIndex( iterable )
Parameter: This function has the following parameter as mentioned above and described below:
- iterable: Insert any kind of iterable object.
Return Value: It will return the index of maximum 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.maxIndex() method, we are able to find the index of a maximum value in an array of numbers, strings and date formatted by this method.
Example 2: Filename: index.js
Note: The above program will compile and run by using the following command: