// 构造函数new关键字执行过程// 1.new 构造函数在内存中创建一个空对象// 2.this指向创建的空对象// 3.执行构造函数内部的代码 给空对象添加属性和方法// 4.返回这个新对象(所以构造函数里不需要return)function Star(name, age, sex) {this.name = namethis.age = agethis.sex = sex}var str = new Star('林俊杰', 18, '男')consol
笔记
2023-10-01
43 点赞
0 评论
65 浏览