I habitually pass parameters to functions as object literals, thus....
calling:
render({
param1: 99
param2: {'a': 88, 'b': 77}
});
method:
render: function (p) {
alert( p.param1);
var data = p.param2;
etc
}
I tend to pass parameters like this in all cases nowadays - even if the function / method only accepts 1 argument. The reason is that I find this method neat and also if I wish to add another parameter at a later date it is simple to add to to the object.
I would like to know from some experienced javascript people if there is any reason why doing things in this way might be a bad idea - I do not work with other developers so am sometimes unsure if the way I do things is correct.
Thanks!