构造函数--1.创建

Posted ruoxiangli

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了构造函数--1.创建相关的知识,希望对你有一定的参考价值。

function Demo(name,age)
this.name = name
this.age = age
this.sing = function()
console.log(this.name + "唱歌")


let lx = new Demo(‘张三‘,10)
lx.sing()

 

以上是关于构造函数--1.创建的主要内容,如果未能解决你的问题,请参考以下文章