-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathB.html
198 lines (159 loc) · 9.34 KB
/
B.html
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<html>
<head>
<title>The JavaScript Encyclopedia: B</title>
<link rel="stylesheet" href="encyclopedia.css" type="text/css">
</head>
<body>
<h1>B</h1>
<h2 id="bind">bind</h2>
<h3 id="bind function prototype function"><code>bind</code> <code>function</code> prototype function</h3>
<p>Blah.</p>
<p class="es3">The <code>bind</code> function is not available in <a href="E.html#ES3">ES3</a>.</p>
<h2 id="bitwise operator">bitwise operator</h2>
<p>A bitwise operator treats a <a href="N.html#number">number</a> as a 32 bit 2's complement signed integer. The bitwise operators
are</p>
<ul>
<li><a href="special.html#ampersand%20infix%20operator"><code>&</code> infix
operator</a> <dfn>bitwise and</dfn></li>
<li><a href="special.html#bar%20infix%20operator"><code>|</code> infix operator</a>
<dfn>bitwise or</dfn></li>
<li><a href="special.html#caret%20infix%20operator"><code>^</code> infix operator</a>
<dfn>bitwise exclusive or</dfn></li>
<li><a href="special.html#ampersandlt;<%20infix%20operator"><code><<</code>
infix operator</a> <dfn>bitwise left shift</dfn></li>
<li><a href="special.html#greater>%20infix%20operator"><code>>></code>
infix operator</a> <dfn>bitwise signed right shift</dfn></li>
<li><a href="special.html#greater>>%20infix%20operator"><code>>>></code>
infix operator</a> <dfn>bitwise unsigned right shift</dfn></li>
<li><a href="special.html#tilde%20infix%20operator"><code>~</code> prefix
operator</a> <dfn>bitwise not</dfn></li>
</ul>
<p>These operators allow access to some of the primitive operations of CPUs. They all treat <a href="N.html#NaN"><code>NaN</code></a>, <a href="N.html#null"><code>null</code></a>, and <a href="U.html#undefined"><code>undefined</code></a> as <code>0</code>. Also see <a href="I.html#integer">integer</a>.</p>
<p>Example:</p>
<pre>var raw_base64 = (function (alphabet) {
// The raw_base64 object contains two methods, encode and decode, that convert
// strings to base64 and back, as specified in Multipurpose Internet Mail
// Extensions (MIME) Section 6.8. URL: http://www.ietf.org/rfc/rfc2045.txt.
// The standard also requires padding with = and the breaking and joining of
// lines no longer than 76 characters. We are not concerned with that. All
// we are doing here is encoding groups of 3 8-bit characters as 4 7-bit
// characters.
// The original motivation for doing this was to avoid data interchange
// problems caused by poor architectural choices in some mid 20th century
// operating systems. These workarounds became standards that are still in
// force, decades after solution of the root problem. Once something gets into
// a standard, it can take generations to get rid of it.
// We will encode using an alphabet of 64 characters: 26 upper case letters,
// 26 lower case letters, 10 digits, and two special characters. For efficent
// decoding, we will invert the alphabet ('ABC...9+/') into an object, producing
// {
// A: 0,
// B: 1,
// C: 2,
// ...
// '9': 61,
// '+': 62,
// '/': 63
// }
var alphabet =
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
tebahpla = {};
alphabet.split('').forEach(function (value, index) {
tebahpla[value] = index;
});
// Return the object containing the encode and decode methods.
return {
encode: function (unencoded) {
var i,
length = unencoded.length,
result = [],
in0,
in1,
in2;
for (i = 0; i < length; i += 3) {
// Get the next three character codes.
in0 = unencoded.charCodeAt(i);
in1 = unencoded.charCodeAt(i + 1);
in2 = unencoded.charCodeAt(i + 2);
// Redistribute 3 sets of 8 bits into 4 sets of 6 bits.
// in: abcdefgh ijklmnop qrstuvwx
// out: 00abcdef 00ghijkl 00mnopqr 00stuvwx
// This involves shifting bits into a new positions, using & (and) to mask off
// some bits, and using | (or) to combine.
// Translate the 6-bit values into symbols of the alphabet and push them into
// the results.
result.push(alphabet[in0 >> 2]);
result.push(alphabet[((in0 & 3) << 4) | (in1 >> 4)]);
// We only output the third character if in1 was present.
if (!isNaN(in1)) {
result.push(alphabet[((in1 & 15) << 2) | (in2 >> 6)]);
// And we only output the fourth character if in2 was present.
if (!isNaN(in2)) {
result.push(alphabet[in2 & 63]);
}
}
}
// Return the result string.
return result.join('');
},
decode: function (encoded) {
var i,
length = encoded.length - 1,
result = [],
in0,
in1,
in2,
in3;
for (i = 0; i < length; i += 4) {
// Get the next four character codes.
in0 = tebahpla[encoded.charAt(i)];
in1 = tebahpla[encoded.charAt(i + 1)];
in2 = tebahpla[encoded.charAt(i + 2)];
in3 = tebahpla[encoded.charAt(i + 3)];
// Redistribute 4 sets of 6 bits into 3 sets of 8 bits.
// in: 00abcdef 00ghijkl 00mnopqr 00stuvwx
// out: abcdefgh ijklmnop qrstuvwx
// Combine bits from in0 and in1 to produce the first character code.
// Convert the code into a character, and push it onto the result.
result.push(String.fromCharCode((in0 << 2) | (in1 >> 4)));
// We only output the second character if in2 was present.
if (in2 !== undefined) {
result.push(String.fromCharCode(((in1 & 15) << 4) | (in2 >> 2)));
// And we only output the third character if in3 was present.
if (in3 !== undefined) {
result.push(String.fromCharCode(((in2 & 3) << 6) | in3));
}
}
}
// Return the result string.
return result.join('');
}
};
}());</pre>
<h2 id="blink">blink</h2>
<p><blink>Blah.</blink></p>
<h2 id="block">block</h2>
<p>A block is a compound <a href="S.html#statement">statement</a> that can occur anywhere that a <a href="S.html#statement">statement</a> can occur. It begins with a <a href="special.html#leftbrace"><code>{</code> <dfn>left curly brace</dfn></a> and ends with a <a href="special.html#}"><code>}</code> <dfn>right curly brace</dfn></a>, and between the two curly braces there are zero or more statements. Blocks are commonly used as parts of other statements, such as <a href="I.html#if statement"><code>if</code> statement</a> and <a href="W.html#while statement"><code>while</code> statement</a>.</p>
<p>A brace does not create a new <a href="S.html#scope">scope</a>. Only a function has <a href="S.html#scope">scope</a>. In many other languages, a block does create a <a href="S.html#scope">scope</a>, so that a <a href="V.html#variable">variable</a> that is declared inside of a block is not visible outside of the block. That does not happen in the language, which is why it is unwise to declare a <a href="variable">variable</a> in a block.</p>
<h2>body</h2>
<p>See <a href="F.html#function body">function body</a>.</p>
<h2 id="boolean">boolean</h2>
<p>The boolean type is named after the mathematician George Boole. The boolean type contains exactly two values: <a href="T.html#true"><code>true</code></a> and <a href="F.html#false"><code>false</code></a>. The <a href="T.html#typeof prefix operator"><code>typeof</code> prefix operator</a> returns <code>'boolean'</code> when its operand is a boolean. A boolean value is produced by a <a href="R.html#relational operator">relational operator</a>.</p>
<h3 id="Boolean global function"><code>Boolean</code> global function</h3>
<p>The <code>Boolean(</code><var>value</var><code>)</code> <a href="G.html#global function">global function</a>, when called as function, evaluates its parameter. If the value was <a href="T.html#truthy">truthy</a>, it returns <a href="T.html#true"><code>true</code></a>. If the value was <a href="F.html#falsy">falsy</a>, it returns <a href="F.html#false"><code>false</code></a>. </p>
<h3 id="boolean literal">boolean literal</h3>
<p>There are two boolean literals, representing the two boolean values: <a href="T.html#true"><code>true</code></a> and <a href="F.html#false"><code>false</code></a>.</p>
<h2 id="boolish">boolish</h2>
<p>Every value in JavaScript is boolish in that it is either <a href="T.html#truthy">truthy</a> or <a href="F.html#falsy">falsy</a>. The <a href="#boolean">boolean</a> type contains only the <code>true</code> and <code>false</code> values, but the boolish type includes all values.</p>
<h2 id="bound variable">bound variable</h2>
<p>Blah.</p>
<h2>brace</h2>
<p>See <a href="special.html#leftbrace"><code>{</code> <dfn>left curly brace</dfn></a> and <a href="special.html#}"><code>}</code> <dfn>right curly brace</dfn></a>.</p>
<h2>bracket</h2>
<p>See <a href="special.html#leftbracket"><code>[</code> <dfn>left bracket
</dfn></a> and <a href="special.html#rightbracket"><code>]</code> <dfn>right bracket</dfn></a>.</p>
<h2 id="break">break <a href="R.html#reserved word"><strong>reserved word</strong></a></h2>
<h3 id="break statement"><code>break</code> statement</h3>
<p>Blah.</p>
</body>
</html>