Argument question javascript
<p>One more question regarding arguments in javascript. I was reading a tutorial about the javascript framework Prototype and came over the following text, I will quote below:</p>

<p>"If you have some DOM methods of your own that you'd like to add to those of Prototype, no problem! Prototype provides a mechanism for this, too. Suppose you have a bunch of functions encapsulated in an object, just pass the object over to Element.addMethods():</p>

<pre><code>var MyUtils = {
    truncate: function(element, length){
        element = $(element);
        return element.update(element.innerHTML.truncate(length));
    },
    updateAndMark: function(element, html){
        return $(element).update(html).addClassName('updated');
    }
}

Element.addMethods(MyUtils);

// now you can:
$('explanation').truncate(100);
</code></pre>

<p>The only thing to watch out here is to make sure the first argument of these methods is the element itself. In your methods, you can also return the element in the end to allow for chainability (or, as practiced in the example, any method which itself returns the element)."</p>

<p>Everything seems pretty straightforward except one thing that I seem to have problem understanding. It says that you need to make sure the first argument of these methods is the element itself. And that is the case in the functions but when you call the function you only provide 1 argument? So for example:</p>

<pre><code>$('explanation').truncate(100);  
</code></pre>

<p>There is only 1 argument here that is sent to the function namely 100, but the function signature looks like this:</p>

<pre><code>truncate: function(element, length){
</code></pre>

<p>So element comes from where? And is it logic that you must make sure that the first argument is the element itself but you do not provide it when you call the function?</p>
