The whole point of using the methodize Function:prototype method is
NOT to have to pass an object in any function as a second argument,
but to call the function in the scope of any arbitrary object, isn't
it? At least, this is what the documentation explains.


On Apr 16, 9:49 am, Victor <[email protected]> wrote:
> Where is the second argument in multiplier()? I'll try to explain in
> example:
>
> function multiplier(obj, times) {
>   times = isNaN(times) ? 2 : times;
>   if (typeof obj.value != 'undefined') {
>     return obj.value * times;
>   } else {
>     alert(obj + ': does not have a value property!');
>   }
>
> }
>
> obj_a.multiply = multiplier.methodize();
> multiplier(obj_a, 2); // same as obj_a.multiply(2);
> obj_a.multiply(2); // same as multiplier(obj_a, 2);

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to