VOOZH about

URL: https://www.geeksforgeeks.org/javascript/d3-js-d3-pairs-function/

⇱ D3.js | d3.pairs() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

D3.js | d3.pairs() function

Last Updated : 28 Jun, 2019
The d3.pairs() function in D3.js is used to create pair of array elements from the given array elements. If the given array is having less than two elements then it returns the empty array. Syntax:
d3.pairs(Array)
Parameters: This function accepts a parameter Array whose elements are going to be paired. Return Value: It returns the array of paired elements. Below programs illustrate the d3.pairs() function in D3.js. Example 1: Output:
[[10, 20], [20, 30], [30, 40]]
[[1, 2], [2, 3], [3, 4]]
Example 2:
Output:
[[A, B], [B, C]]
[a, b]
Comment
Article Tags: