aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/conflicting/web/javascript/reference/global_objects/boolean/index.html
blob: c835071fadb35499a51d55e96c65e242f64fea1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
title: Boolean.prototype
slug: conflicting/Web/JavaScript/Reference/Global_Objects/Boolean
tags:
  - Boolean
  - JavaScript
  - Property
  - Prototype
translation_of: Web/JavaScript/Reference/Global_Objects/Boolean
translation_of_original: Web/JavaScript/Reference/Global_Objects/Boolean/prototype
original_slug: Web/JavaScript/Reference/Global_Objects/Boolean/prototype
---
<p>{{JSRef}}</p>

<p><strong><code>Boolean.prototype</code></strong> 属性表示{{jsxref("Boolean")}} 构造函数的原型。</p>

<div>{{js_property_attributes(0,0,0)}}</div>

<h2 id="Description" name="Description" style="margin-bottom: 20px; line-height: 30px;">描述</h2>

<p>{{jsxref("Boolean")}}实例继承自<code>Boolean.prototype</code>。你可以使用构造函数的原型对象向所有{{jsxref("Boolean")}}实例添加属性或方法。</p>

<h2 id="属性" style="margin-bottom: 20px; line-height: 30px;">属性</h2>

<dl>
 <dt><code>Boolean.prototype.constructor</code></dt>
 <dd>返回创建了实例原型的函数。默认为{{jsxref("Boolean")}}函数。</dd>
</dl>

<h2 id="方法" style="margin-bottom: 20px; line-height: 30px;">方法</h2>

<dl>
 <dt>{{jsxref("Boolean.prototype.toSource()")}} {{ Non-standard_inline() }}</dt>
 <dd>返回包含{{jsxref("Boolean")}}对象源码的字符串;你可以使用这个字符串来创建一个等价的对象。覆盖了{{jsxref("Object.prototype.toSource()")}} 方法。</dd>
 <dt>{{jsxref("Boolean.prototype.toString()")}}</dt>
 <dd>根据对象的值来返回一个字符串:<code>"true"</code><code>"false"</code>。覆盖了 {{jsxref("Object.prototype.toString()")}} 方法。</dd>
 <dt>{{jsxref("Boolean.prototype.valueOf()")}}</dt>
 <dd>返回{{jsxref("Boolean")}}对象的原始值。覆盖了 {{jsxref("Object.prototype.valueOf()")}} 方法。</dd>
</dl>

<h2 id="规范" style="margin-bottom: 20px; line-height: 30px;">规范</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('ES1')}}</td>
   <td>{{Spec2('ES1')}}</td>
   <td>Initial definition. Implemented in JavaScript 1.0.</td>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-15.6.3.1', 'Boolean.prototype')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-boolean.prototype', 'Boolean.prototype')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-boolean.prototype', 'Boolean.prototype')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容" style="margin-bottom: 20px; line-height: 30px;">浏览器兼容</h2>

<p>{{Compat("javascript.builtins.Boolean.prototype")}}</p>