4. function ArgTest(a, b){
var s = "";
s += "Expected Arguments: " + ArgTest.length;
s += "<br />";
s += "Passed Arguments: " + arguments.length;
return s;
}
5. Calls a function with a given this value and
arguments provided individually.
Syntax
› fun.call(thisArg[, arg1[, arg2[, ...]]])
6. function diplayInfo(year, month, day){
return "Name:" + this.name + ";birthday:" + year +
"." + month + "." + day;
}
var p = { name: "Jason" };
diplayInfo.call(p, 1985, 11, 5);
7. Calls a function with a given this value
and arguments provided as an array
Syntax
› fun.apply(thisArg[, argsArray])
8. function diplayInfo(year, month, day){
return "Name:" + this.name + ";birthday:" + year +
"." + month + "." + day;
}
var p = { name: "Jason" };
console.log(diplayInfo.apply(p, [1985, 11, 5]));
9. Specifies the currently executing function
callee is a property of the arguments object.
Syntax
› [function.]arguments.callee
10. function factorial(n){
if (n <= 0)
return 1;
else
return n * arguments.callee(n - 1);
}
factorial(4);
11. Creates a new function that, when
called, has its this keyword set to the
provided value, with a given sequence
of arguments preceding any provided
when the new function is called.
Syntax
fun.bind(thisArg[, arg1[, arg2[, ...]]])
13. var checkNumericRange = function (value) {
return value >= this.min && value <= this.max;
}
var range = { min: 10, max: 20 };
var boundCheckNumericRange =
checkNumericRange.bind(range);
var result = boundCheckNumericRange (12);
Result = ??