Is it redundant to check function arguments before continuing?
eg.
var doFoo = function(id, message){
goog.asserts.assertNumber(id, "Expecting a numeric id.");
goog.asserts.assertString(message, "Expecting a string.");
}
Note. This is using the closing library statement statements, but any such logic can use any library or no library at all, you get the idea.
EDIT: I think this question is subjective. The best question would be ... When is it too difficult to check function arguments? I think.
source
share