1.
1function?test(){
3????alert(arguments.length);//實參的數目
4?????alert(test.length);//行參的數目
5}
2.callee返回當前方法的引用
1function?test(){
3????alert(arguments.callee.length);//行參的數目
4?????//arguments.callee返回當前方法的引用,所以
5?????//arguments.callee?==?test
6????//所以實際上仍然偽test.length
7}
3.call(),apply()
call()傳遞單個參數,apply()參數傳遞為數組參數
1var?Class?=?{
2??create:?function()?{
3????return?function()?{
4??????this.initialize.apply(this,?arguments);
5????}

6??}

7}

8

?1var?vehicle=Class.create();//vehicle為一個方法,所以可以有prototype屬性。返回的是一個構造函數。
?3vehicle.prototype={
?4????initialize:function(type){//這個方法在創建vihicle的對象的時候被調用
?5????????this.type=type;
?6????}

?7????showSelf:function(){
?8????????alert("this?vehicle?is?"+?this.type);
?9????}

10}

11
12var?moto=new?vehicle("Moto");
13moto.showSelf();
14