1.jsçfunctionåµå¥functionï¼ç¬¬ä¸ä¸ªfunctionå¯ä»¥å¯ä»¥å½å¯¹è±¡ä½¿ç¨åï¼ ä¾å¦è¦å®ç°å¦ä¸åè½ï¼
jsçfunctionåµå¥functionï¼ç¬¬ä¸ä¸ªfunctionå¯ä»¥å¯ä»¥å½å¯¹è±¡ä½¿ç¨åï¼ ä¾å¦è¦å®ç°å¦ä¸åè½ï¼
å½ç¶å¯ä»¥å½å¯¹è±¡~ï¼
ä½ çåæ³åªæ¯æ®éå½æ°çåæ³ï¼ä½ä½ è¦ä»ç¨newæé 对象ï¼é£å é¨å±æ§è¦å ä¸thisï¼æ¥å¨æç»å®çæç对象ï¼èä½ ç®ååæ³ï¼åªè½è¯´æ¯Aå½æ°çç§æåéï¼æ¯ä¸ä¼éè¿newä¼ åºæ¥çï¼æ以åªéè¦æä½ çå é¨å½æ°åæ this.a=function(){ }è¿ç§å¯¹è±¡å±æ§çæ ·å¼æè½æ£ç¡®ççéè¿new çæä½ éè¦ç对象~ï¼
function A(){
var p=1;
var q;
this.A=function (x){
q=2;
alert(x+p);
}
this.B=function (x){
alert(p+q+x);
}
}
var a=new A();
a.A(5);
a.B(6);
2024-11-30 05:04
2024-11-30 04:56
2024-11-30 04:19
2024-11-30 03:53
2024-11-30 03:23
2024-11-30 02:57