1.function 构造函数名(){
this.属性=值;
this.方法=function(){}
}
2.new 构造函数名();
3.构造函数名首字母大写
4.调用构造函数必须要用new
5.属性和方法前面必须添加this. 谁new(实例化)就指向谁
6.可以利用new Star()重复调用
function Star(){this.name=uname;this.age=age;this.sex=sex;this.sing=function(simg){console.log(sing)}}var ldh =new Star("刘德华",18,"男");var zxy =new Star("张学友",20,"男");console.log(ldh["name"]); //或者console.log(ldh.name)console.log(ldh);ldh.sing("冰雨");
<script>function Student(name,age){this.name=name;this.age=age;}//this指实例化的对象var liu=new Student("刘德华",18);console.log(liu);console.log(liu.name); //读取对象的属性</script>

