-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathT.html
179 lines (153 loc) · 8.94 KB
/
T.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
<html>
<head>
<title>The JavaScript Encyclopedia: T</title>
<link rel="stylesheet" href="encyclopedia.css" type="text/css">
</head>
<body><h1>T</h1>
<h2 id="tan">tan</h2>
<h3 id="tan Math function"><code>tan</code> <code>Math</code> function <dfn>tangent</dfn></h3>
<p><code>The Math.tan(</code><var>radians</var><code>)</code> function, also known as tangent, takes an angle in <a href="R.html#radians">radians</a> and returns a number.</p>
<p>This is an approximate implemention of <code>Math.tan</code>:</p>
<pre>Math.tan = function tan(radians) {
return Math.sin(radians) / Math.cos(radians);
};</pre>
<p>See <a href="M.html#Math function"><code>Math</code> function</a>. </p>
<h2 id="ternary operator">ternary operator</h2>
<p>A ternary operator is an operator that takes three operands. JavaScript has only one ternary operator, the <a href="special.html#question ternary operator"><code>?</code> ternary operator</a> <dfn>conditional</dfn>.</p>
<h2 id="test">test</h2>
<h3 id="test Regexp prototype function"><code>test</code> <code>RegExp</code> prototype function</h3>
<p>Blah.</p>
<h2>this <a href="R.html#reserved word"><strong>reserved word</strong></a></h2>
<h3><code>this</code> parameter</h3>
<p>Blah.</p>
<h2>throw <a href="R.html#reserved word"><strong>reserved word</strong></a></h2>
<h3><code>throw</code> statement</h3>
<p>Blah.</p>
<h2 id="toDateString">toDateString</h2>
<h3 id="toDateString Date prototype function"><code>toDateString</code> date prototype function</h3>
<p>Blah.</p>
<h2 id="toExponential">toExponential</h2>
<h3 id="toExponential Number prototype function"><code>toExponential</code> number prototype function</h3>
<p>Blah.</p>
<h2 id="toFixed">toFixed</h2>
<h3 id="toFixed Number prototype function"><code>toFixed</code> number prototype function</h3>
<p>Blah.</p>
<h2 id="toGMTString">toGMTString</h2>
<h3 id="toGMTString Date prototype function"><code>toGMTString</code> date prototype function</h3>
<p>Blah.</p>
<h2 id="toISOString">toISOString</h2>
<h3 id="toISOString Date prototype function"><code>toISOString</code> date prototype function</h3>
<p>Blah.</p>
<h2 id="token">token</h2>
<dl class="box">
<dt>token</dt>
<dd>comment</dd>
<dd>name</dd>
<dd>number_literal</dd>
<dd>operator</dd>
<dd>punctuator</dd>
<dd>regexp_literal</dd>
<dd>string_literal</dd>
<dd>whitespace</dd>
</dl>
<p>A <a href="C.html#compilation unit">compilation unit</a> is made up of tokens. The tokens of this language are</p>
<ul>
<li><a href="C.html#comment">comment</a></li>
<li><a href="N.html#name">name</a></li>
<li><a href="N.html#number literal">number literal</a></li>
<li><a href="O.html#operator">operator</a></li>
<li><a href="P.html#punctuator">punctuator</a></li>
<li><a href="R.html#regexp literal">regexp literal</a></li>
<li><a href="S.html#string literal">string literal</a></li>
<li><a href="W.html#whitespace">whitespace</a></li>
</ul>
<h2 id="toLocaleDateString">toLocaleDateString</h2>
<h3 id="toLocaleDateString Date prototype function"><code>toLocaleDateString</code> date prototype function</h3>
<p>Blah.</p>
<h2 id="toLocaleFormat">toLocaleFormat</h2>
<h3 id="toLocaleFormat Number prototype function"><code>toLocaleFormat</code> number prototype function</h3>
<p>Blah.</p>
<h2>toLocaleLowerCase</h2>
<h3 id="toLocaleLowerCase string prototype function"><code>toLocaleLowerCase</code> string prototype function</h3>
<p>Blah.</p>
<h2 id="toLocaleString">toLocaleString</h2>
<h3 id="toLocaleString Object prototype function"><code>toLocaleString</code> object prototype function</h3>
<p>Blah.</p>
<h2 id="toLocaleTimeString">toLocaleTimeString</h2>
<h3 id="toLocaleTimeString Date prototype function"><code>toLocaleTimeString</code> date prototype function</h3>
<p>Blah.</p>
<h2>toLocaleUpperCase</h2>
<h3 id="toLocaleUpperCase string prototype function"><code>toLocaleUpperCase</code> string prototype function</h3>
<p>Blah.</p>
<h2 id="toLowerCase">toLowerCase</h2>
<h3 id="toLowerCase String prototype function"><code>toLowerCase</code> string prototype function</h3>
<p>Blah.</p>
<h2 id="toPrecision">toPrecision</h2>
<h3 id="toPrecision Number prototype function"><code>toPrecision</code> number prototype function</h3>
<p>Blah.</p>
<h2 id="toString">toString</h2>
<h3 id="toString Array prototype function"><code>toString</code> <code>Array</code> prototype function</h3>
<p>Blah.</p>
<h3 id="toString Boolean prototype function"><code>toString</code> <code>Boolean</code> prototype function</h3>
<p>Blah.</p>
<h3 id="toString Number prototype function"><code>toString</code> <code>Number</code> prototype function</h3>
<p>Blah.</p>
<h3 id="toString Object prototype function"><code>toString</code> <code>Object</code> prototype function</h3>
<p>Blah. "Arguments", "Array", "Boolean", "Date", "Error", "Function", "JSON", "Math", "Number", "Object", "RegExp", and "String"</p>
<h2 id="toTimeString">toTimeString</h2>
<h3 id="toTimeString Date prototype function"><code>toTimeString</code> Date prototype function</h3>
<p>Blah.</p>
<h2 id="toUpperCase">toUpperCase</h2>
<h3 id="toUpperCase String prototype function"><code>toUpperCase</code> string prototype function</h3>
<p>Blah.</p>
<h2 id="trim">trim</h2>
<h3 id="trim String prototype function"><code>trim</code> string prototype function</h3>
<p>Blah.</p>
<h2>true <strong>reserved word</strong></h2>
<p>Blah.</p>
<h3><code>true</code> literal</h3>
<p>Blah.</p>
<h2 id="truthy">truthy</h2>
<p>Blah.</p>
<h2>try <a href="R.html#reserved word"><strong>reserved word</strong></a></h2>
<h3><code>try</code> statement</h3>
<p>Blah.</p>
<p>In the example for <a href="C.html#callback">callback</a>, a potential problem with the <code>setStatus</code> function is that if any of the callback functions throw an exception, the remaining callback functions will not be executed. This can be guarded against by wrapping the invocation of each of the callbacks in a <code>try</code> statement. This will allow <code>setStatus</code> to carry on. In this case, the <code>catch</code> clause is empty because we don't care what the exception was. In all cases we recover by ignoring the exception and allowing <code>forEach</code> to proceed to the next iteration.</p>
<pre> setStatus: function (newStatus) {
status = newStatus;
subscribers.forEach(function (callback) {
try {
callback(status);
} catch (e) {}
});
}</pre>
<p>There are some errors that cannot be caught by a <code>try</code> statement, such as exceeding implementation dependent limits on recursion depth, memory consumption, or execution time.</p>
<p class="es3">The catch scope problem.</p>
<h2 id="turn">turn</h2>
<p>Program execution happens in turns. First, each compilation unit is given one turn in which it executes to completion. In some environments, that is the end of the program. But in sessionful environments like web browsers, turns will then be given to events, including UI events generated by the user, by the network stack, by the file system, and by interprocess communication, and timer events. An event handler function or deferred function, when given its turn, will run to completion. Once it has completed (usually by returning) then the program goes idle until another event occurs. The next event must wait until the previous turn ends.</p>
<p>The turn model avoids a large class of concurrency hazards, particularly deadlock and race conditions. The turn model tends to make programs easier to make and more reliable than the thread model.</p>
<p>The greatest hazard in the turn model is that if a turn takes too long, then the system becomes unresponsive. This can be avoided by distributing long-running functions to other processes. Processes can communicate with each other (typically using a JSON message delivered as an event or callback) but are unable to directly access the variables or data structures of other processes, thus avoiding the hazards of the thread model. The process model is not yet universally adopted in browsers, but is quickly gaining popularity.</p>
<h2 id="type">type</h2>
<p>These are the types in this language:</p>
<ul>
<li><a href="A.html#array">array</a></li>
<li><a href="B.html#boolean">boolean</a></li>
<li><a href="D.html#date">date</a></li>
<li><a href="F.html#function">function</a></li>
<li><a href="N.html#null">null</a></li>
<li><a href="N.html#number">number</a></li>
<li><a href="O.html#object">object</a></li>
<li><a href="R.html#regexp">regexp</a></li>
<li><a href="S.html#string">string</a></li>
<li><a href="U.html#undefined">undefined</a></li>
</ul>
<p>An implementation or environment may add additional types.
</p>
<h2 id="TypeError">TypeError</h2>
<h3 id="TypeError global function"><code>TypeError</code> global function</h3>
<p>Blah.</p>
<h2>typeof <a href="R.html#reserved word"><strong>reserved word</strong></a></h2>
<h3><code>typeof</code> prefix operator</h3>
<p>Blah.</p>
</body>
</html>