初面网初面网

构造器

// 构造函数
function People(name,age){
    this.name = name
    this.age = age

    this.say = function(){
        console.log(this.name, this.age)
    }
}

var people1 = new People("Tom", 18)
people1.say()

console.log(people1)

更新于 2025/2/26