1、
var Book={
bookName:"javascript程序设计",
bookPrice:"29.2",
bookIntruduce:function(){
document.write("name:"+bookName+"price:"+bookPrice);
}
}
Book.bookIntruduce();
*/
2、对象的删除、销毁
/*
function Person(name,age){
this.name=name;
this.age=age;
}
var person=new Person("guanxianfei","21");
document.write(person.name);
delete person.age;//删除对象
document.write(person.age);
person.age=null;//销毁对象
document.write(person.age);
*/
3、遍历对象:
/*
function Person(name,age){
this.name=name;
this.age=age;
}
var obj=new Person("guanxianfei","21");
function ListPlane(obj){
var str="";
for(var ppt in obj){
str+=ppt+":"+obj[ppt]+"</br>";
}
document.write("==="+str+"</hr>");
}
ListPlane(obj); //obj=对象
*/
4、Object对象:
/*
var n=new Object();
n.name="guanxianfei"
n.intr=function(){
document.write(this.name);
}
n.intr();
*/
5、构造函数:打印出js源代码
/*
function Constractord(name){
this.name=name;
}
var constractord=new Constractord("guanxiangf");
document.write("<red>"+constractord.constructor+"</red>")
*/
6、call、apply的使用:
/*
function Person(name){
this.name=name;
//this.age=age;
this.say=function(boo,bbb){
document.write(this.name+":"+boo+":"+bbb+":"+this.name);
}
}
var person1=new Person("guanxianfei","21");
var person2=new Person("zhangping","21");
document.write(person1.name+"</br>");
document.write(person2.say.call(person1,"name","name2"));
//document.write(person1.say.apply(person2,["name3","name4"]));
//call apply 对象的参数支持多个,但最后的参数值为Undfined,求高手解答。
输出的结果为:
guanxianfei
guanxianfei:name:name2:guanxianfeiundefined
*/