码迷,mamicode.com
首页 > Web开发 > 详细

JS对象的创建

时间:2015-09-16 12:44:28      阅读:149      评论:0      收藏:0      [点我收藏+]

标签:

/* people = new Object();
people.name = "iwen";
people.age = "age";
document.write("name:"+people.name+",age:"+people.age);*/

/*people = {name: "iwen",age: "30"};
document.write("name"+people.name+",age"+people.age);*/

function people(name,age){
this.name = name;
this.age = age;
}
son = new people("iwen",30);
document.write("name:"+son.name+",age:"+son.age);

JS对象的创建

标签:

原文地址:http://www.cnblogs.com/htmlphp/p/4812775.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!