js中的constructor怎么用

2025-05-15 21:03:04
推荐回答(1个)
回答(1):



function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}

var bill=new employee("Bill Gates","Engineer",1985);

document.write(bill.constructor);

那么输出的结果是

function employee(name, job, born)
{this.name = name; this.job = job; this.born = born;}