(function(count){
for(var i=0;i<count;i++){
console.log(i);//=>0、1、2、3、4
}
console.log(i);//=>5
})(5);
(function(){
var now=new Date();
if(now.getMonth()==0 && now.getDate()==1){
console.log("新年快乐");
}else{
console.log("尽情期待");
}
})();
function Person(name){
this.getName=function(){
return name;
};
this.setName=function(value){
name=value;
};
}
var person1=new Person("Jason");
console.log(person1.getName());//=>Jason
person1.setName("gray");
console.log(person1.getName());//=>gray
var person2=new Person("Michael");
console.log(person1.getName());//=>gray
console.log(person2.getName());//=>Michael
person2.setName('Alex');
console.log(person1.getName());//=>gray
console.log(person2.getName());//=>Alex
(function(){
//私有变量和函数
var name="";
Person=function(value){
name=value;
};
//特权方法
Person.prototype.getName=function(){
return name;
};
Person.prototype.setName=function(value){
name=value;
}
})();
var person1=new Person("Jason");
console.log(person1.getName());//=>Jason
person1.setName("gray");
console.log(person1.getName());//=>gray
var person2=new Person("Michael");
console.log(person1.getName());//=>Michael
console.log(person2.getName());//=>Michael
person2.setName('Alex');
console.log(person1.getName());//=>Alex
console.log(person2.getName());//=>Alex
var application=function(){
//私有变量和函数
var components=[];
//初始化
components.push(new BaseComponent());
//公共接口
return {
getComponentCount:function(){
return components.length;
},
registerComponent:function(){
if(typeof component=="object"){
components.push(component);
}
}
}
}();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有