Code
<script language = "javascript" type = "text/javascript">
function check(args) {
var actual = args.length; //the actual length of the args
if (actual != args.callee.length)//the expect number of the arguments
throw new Error("Wrong number args passed error!!");
}
function f(x, y, z) {
check(arguments);
return x + y + z;
}
document.write("The sum is "+f(1,2));
</script>
<script language = "javascript" type = "text/javascript">
function check(args) {
var actual = args.length; //the actual length of the args
if (actual != args.callee.length)//the expect number of the arguments
throw new Error("Wrong number args passed error!!");
}
function f(x, y, z) {
check(arguments);
return x + y + z;
}
document.write("The sum is "+f(1,2));
</script>