Qual a melhor forma de implementar parâmetros no JavaScript?
Estou usando Javascript com jQuery. Eu gostaria de implementar parâmetros. Em C #, seria algo parecido com isto:
/*
* odp the object to test
* error a string that will be filled with the error message if odp is illegal. Undefined otherwise.
*
* Returns true if odp is legal.
*/
bool isLegal(odp, out error);
Qual é a melhor maneira de fazer algo assim em JS? Objetos?
function isLegal(odp, errorObj)
{
// ...
errorObj.val = "ODP failed test foo";
return false;
}
O Firebug me diz que a abordagem acima funcionaria, mas existe uma maneira melhor?