D3.js pairs() method
With the help of d3.pairs() method, we can get the array from the iterables where adjacent elements that is “i”th element and (i-1)th element passes through the reducer function to get the output.
Return value: It will return the single array of reduced pairs.
Note: To execute the below examples you have to install the d3 library by using the command prompt for the following command.
npm install d3
Example 1: In this example, we can see that by using d3.pairs() method, we are able to get the single array having pairs from iterable after passing them to the reducer function by using this method.
[ 3, 5, 7, 9, 11 ]
[ 1.5, 2.5, 3.5, 4.5, 5.5 ]
My Personal Notes arrow_drop_up
Please Login to comment...