Boolean();
属性:
constructor();
创建此对象Boolean函数的引用
prototype();
向对象添加属性和方法
例:
<script>
function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}
var bill=new employee("sha","student","1996")
employee.prototype.salary="null";
bill.salary=200;
document.write(bill.salary);
</script>
结果:200
方法:
toSource();
返回对象的源代码
例:
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.toSource());
结果:({name:"Bill Gates", job:"Engineer", born:1985})
toString();
逻辑值转化字符串,返回结果
valueOf();
返回boolean对象原始值
例:
<script>
var boo = new Boolean(false)
document.write(boo.valueOf())
</script>
结果:false
属性:
constructor();
创建此对象Boolean函数的引用
prototype();
向对象添加属性和方法
例:
<script>
function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}
var bill=new employee("sha","student","1996")
employee.prototype.salary="null";
bill.salary=200;
document.write(bill.salary);
</script>
结果:200
方法:
toSource();
返回对象的源代码
例:
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.toSource());
结果:({name:"Bill Gates", job:"Engineer", born:1985})
toString();
逻辑值转化字符串,返回结果
valueOf();
返回boolean对象原始值
例:
<script>
var boo = new Boolean(false)
document.write(boo.valueOf())
</script>
结果:false