VOOZH about

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

⇱ D3.js d3.merge() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

D3.js d3.merge() function

Last Updated : 10 Oct, 2024

The d3.merge() function in D3.js is used to merge the two given arrays into a single array.

Syntax:

d3.merge(Array1, Array2)

Parameters:

This function accepts two parameters which are mentioned above and described below:

  • Array1: This is the first array whose elements are going to be merged with array2.
  • Array2: This is the second array whose elements are going to be merged with array1.

Return Value:

It returns the merged single array.

Example 1: This example shows the use of the merge() function.

Output:

[10, 20, 30, 1, 2, 3]

Example 2: This example shows the use of the merge() function.

Output:

[A, B, C, a, b, c]
Comment
Article Tags: