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

6??}

7}

8

?1var?vehicle=Class.create();//vehicle為一個(gè)方法,所以可以有prototype屬性。返回的是一個(gè)構(gòu)造函數(shù)。
?3vehicle.prototype={
?4????initialize:function(type){//這個(gè)方法在創(chuàng)建vihicle的對(duì)象的時(shí)候被調(diào)用
?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