//1.自定义构造函数创建对象
//👉自定义构造函数:本质也是一个函数,也是创建对象的(程序员自己定义的一个用来创建对象的函数(本质上就是一个函数))
//{}或new内置函数是用来单个对象的或少数的
//自定义构造函数是用来创建大量(批量)对象
//普通创建对象
// let k = new Object();
// k.stuname = 'k同学';
// k.score = 98;
// let d = new Object();
// d.stuname = '段';
// d.score = 99;
//1.自定义构造函数创建对像
//语法
// function 函数名() {
// this.属性 = 值
// this.属性 = 值
// }
//代码演示:
function Student(stuname, score) {
this.stuName = stuname;
this.score = score;
}
//通过自定义构造函数创建对象
let duan = new Student('段', 99);
let huang = new Student('黄', 66);
console.log(duan);
console.log(huang);
function Student(stuname, score) {
this.stuName = stuname;
this.score = score;
this.eat = function () {
console.log('正在