forked from nkronlage/JavaScripture
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboolean.jsdoc
More file actions
69 lines (48 loc) · 1.22 KB
/
boolean.jsdoc
File metadata and controls
69 lines (48 loc) · 1.22 KB
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
Boolean : Object
A true or false value.
Primitive:
true
Spec:
http://www.ecma-international.org/ecma-262/5.1/#sec-15.6
----
Boolean(value : Object) : Boolean
Coerces **value** into a boolean value. You can also use **!!value** to
do the coercion.
<example>
console.log(Boolean(''));
console.log(Boolean('0'));
console.log(Boolean(0));
console.log(Boolean(1));
console.log(Boolean([]));
console.log(Boolean(undefined));
console.log(!!undefined);
</example>
Spec:
http://www.ecma-international.org/ecma-262/5.1/#sec-15.6.1
----
new Boolean(value : Object) : Object
Creates a box for a boolean value.
<example>
var literal = true;
var boxed = new Boolean(true);
console.log(literal === true);
console.log(boxed === true);
console.log(boxed.valueOf() === true);
console.log();
// Literals cannot hold other properties but boxes can
literal.foo = 'bar';
boxed.foo = 'bar';
console.log(literal.foo);
console.log(boxed.foo);
</example>
Spec:
http://www.ecma-international.org/ecma-262/5.1/#sec-15.6.2
----
prototype.toString() : String
Returns a string representation of **this**.
<example>
console.log(true.toString());
console.log(false.toString());
</example>
Spec:
http://www.ecma-international.org/ecma-262/5.1/#sec-15.6.4.2