Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

.call()

Public visualization

.call()

0 stars0🌍 Public
Hhanulik.ondrej@gmail.com
Last edited Aug 24, 2021
Created on Aug 24, 2021

This example demonstrates the JavaScript `.call()` method within a D3.js context, showing how a custom function can be invoked with an explicit `this` binding and arguments. An SVG element is selected using `d3.select` and then passed to the function via the selection’s `.call()` method, along with a data object containing numeric properties. The function logs the selected DOM element, the passed object, and concatenated property values to the console. The visualization itself renders a blank SVG canvas, with the primary output being console-based rather than graphical, using D3 v6 and plain JavaScript.

AI-generated description

výpis do konzole

In this example, this represents the object that "owns" myFunction:<br> document.getElementById("demo").innerHTML = myFunction.call({model: 'necosic'});

function myFunction() { return this; }

<b>Functions are Objects</b><br> The typeof operator in JavaScript returns "function" for functions.

But, JavaScript functions can best be described as objects.

JavaScript functions have both properties and methods.

Comments

Sign in to join the discussion.

MIT Licensed