D3.js | d3.entries() Function
The d3.entries() function in D3.js is used to return an array containing the property names and property values of the specified object or an associative array.
Syntax:
d3.entries(object)
Parameters: This function accepts single parameter object containing key and value in pairs.
Return Value: It returns an array containing the property names and values of the specified object or an associative array.
Below programs illustrate the d3.entries() function in D3.js:
Example 1:
<!DOCTYPE html> <html> <head> <title> d3.entries() function</title> </head> <body> <script> // Initialising an object var month = {"January": 1, "February": 2, "March": 3}; // Calling the d3.entries() function A = d3.entries(month); // Getting the key and value in pairs console.log(A); </script> </body> </html> |
Output:
[{"key":"January","value":1},{"key":"February","value":2},
{"key":"March","value":3}]
Example 2:
<!DOCTYPE html> <html> <head> <title> d3.entries() function</title> </head> <body> <script> // Initialising an object var month = {"GeeksforGeeks": 0, "Geeks": 2, "Geek": 3, "gfg": 4}; // Calling the d3.entries() function A = d3.entries(month); // Getting the key and value in pairs. console.log(A); </script> </body> </html> |
Output:
[{"key":"GeeksforGeeks","value":0},{"key":"Geeks","value":2},
{"key":"Geek","value":3},{"key":"gfg","value":4}]
Reference: https://devdocs.io/d3~5/d3-collection#entries
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- How to get the function name inside a function in PHP ?
- D3.js | d3.hsl() Function
- PHP | Ds\Set last() Function
- PHP | cos( ) Function
- PHP | end() Function
- p5.js | sq() function
- p5.js | abs() function
- p5.js | day() function
- p5.js | pow() function
- PHP | each() Function
- PHP | Ds\Map put() Function
- PHP | Ds\Map xor() Function
- D3.js | d3.sum() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



