RobG says:
> This seems like classic premature optimisation. Passing an object
> should use more memory because an object is created whose properties
> will be accessed and probably assigned to local variables anyway. But
> I expect that the difference in memory use is absolutely minimal.
>
I agree. I tend to use objects where I want to add some description to what
the arguments do.
perform({
operation: function() { do_foo(); },
on: object_bar,
after: function() { do_baz(); }
});
The example may be a bit arbitrary, but you should be able to glean what
perform() does before you even examine its definition.
perform(do_foo, object_bar, do_baz) // would tell you little.
DavidM
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]