Functions are also objects, owning properties and methods, just like ordinary objects.
1,length Property
Arguments.lenght indicates the number of arguments passed in.
The length property of the function is read-only and represents the number of formal parameters. Can be expressed in Arguments.callee.length:
function Check (args) { var actual = args.length; var expected = args.callee.length; if (Actual! = expected) {throw Error (' expected ${expected}, args got ${actual} ') function f (x, Y, z) { check (arguments); return x+y+Z;} f (on)
2.call () and apply () methods
Call () and apply () can be seen as a method of an object, where the first argument is the parent object to invoke the function, which is the context in which the function body obtains a reference to it. For example:
F.call (o) f.apply (o)
Object o to Call function f ();
F.call (o,1,2) f.apply (o,[))
Call and apply a similar function, the only difference is the form of incoming arguments, call is a single pass, apply is in the form of an array.
3,bind () method
Functions of JavaScript (iii)