-
(minus sign)
in regular expressions, 124
operator, 9
with arrays, 144
_
(underscore)
in identifiers, 7
,
(comma)
in let
statements, 42
in URLs, 120
operator, in loops, 41
;
(semicolon)
in URLs, 120
terminating lines with, 6
:
(colon), in URLs, 120
!==
operator, 35
?
(quotation mark)
in regular expressions, 123–127
in URLs, 120
in TypeScript, 303
?:
operator
in regular expressions, 126, 132
in TypeScript, 294
?!
operator, 137
??
, ?.
operators, 38
?<=
, ?=
operators, 137
/
(slash)
in regular expressions, 127
.
(period), in regular expressions, 123–125
./
, ../
, in relative URLs, 211
...
(ellipsis)
in function parameters, 64
spread operator, 115
`. . .`
(backticks), 15
^
(caret)
operator, 39
in regular expressions, 123–125, 127–128
~
(tilde), operator, 39
'. . .'
, ". . ."
(single and double quotes)
for string literals, 13
''
(empty string)
as a Boolean, 34
converting to numbers/strings, 11
(. . .)
(parentheses)
in arrow functions, 55
in conditional statements, 31
in object destructuring, 23
in regular expressions, 123–126, 131–133
starting statements with, 30
[. . .]
(square brackets)
for code units, 15
for symbol keys, 222
in regular expressions, 123–125, 131–133
starting statements with, 30
{. . .}
(curly braces)
and object literals, 18
around single statements, 33
for configuration objects, 67, 292–293
in arrow functions, 55
in import
statements, 212
in regular expressions, 123–126, 131–133
@
(at), in URLs, 120
$
(dollar sign)
in identifiers, 7
in regular expressions, 123–128
in String.replace
method, 135
in URLs, 120
${. . .}
expression, 15, 121, 225
*
(asterisk)
in export
statements, 216
in import
statements, 212
in regular expressions, 123–127, 136
operator, 9
with generator functions, 254–257, 261
*?
operator, 137
**
operator, 10
(backslash)
in , 122
in regular expressions, 123–127
in string literals, 13
in template literals, 16
in URLs, 122
&
(ampersand)
operator, 39
escaping, in HTML, 56
in URLs, 120
#
(number sign)
in method names, 86
in URLs, 120
%
(percent sign)
in URLs, 120
+
(plus sign)
in regular expressions, 123–127, 136
in URLs, 120
+?
operator, 137
+=
operator, 10
<
(left angle bracket)
escaping, in HTML, 56
<<
operator, 39
<. . .>
(angle brackets), for generic parameters, 297
=
(equal sign)
for default parameters, 64
in URLs, 120
===
operator, 35
for array elements, 149
for maps, 158
>>
, >>>
operators, 39
|
(vertical bar)
operator, 39
for union type (TypeScript), 270, 273, 276, 279, 296
in regular expressions, 123–126
0
(zero)
dividing by, 9
leading, in octal numbers, 62, 99
, 14–15, 42, 44, 66, 115–116, 129
Å, 178
π, mathematical constant, 104
abs
function (Math
), 104
acos
, acosh
functions (Math
), 104
add
method (Set
), 158
AggregateError
, 197
all
method (Promise
), 196, 201–202
AMD (Asynchronous Module Definition), 210
any
method (Promise
), 197
any
type (TypeScript), 274–275
apply
method
of Function
, 237
of Reflect
, 242
Array
class
entries
method, 150
filter
method, 56–57, 147, 150–152, 225
find
, findIndex
methods, 147, 149, 151
firstIndex
, lastIndex
methods, 147
flat
method, 147–149, 152, 225
flatMap
method, 147, 151–152, 225
forEach
method, 56, 147, 150–152
from
function, 142, 146, 151–152, 250
includes
method, 147, 149, 271
index
, input
properties, 143
indexOf
method, 149
isArray
function, 279
join
method, 56, 119, 147, 151–152
lastIndexOf
method, 149
length
property, 143
map
method, 56, 147, 151, 153, 225
shift
, unshift
methods, 144, 146
sort
method, 145–147, 152, 176
subarray
method, 225
array buffers, 163
ArrayBuffer
class, 163
building HTML lists from, 56
comparing to other types, 36
converting to:
numbers, 11
elements of:
adding, 144
computing values from, 153–156
deleting, 144
filtering, 150
iterating over, 42–43, 56–57, 150–151, 249–250, 255–257
searching, 149
initializing, 66
sparse, 152
type tests for, 63
with spread operator, 65
vs. generators, 255
with async
, 199
as
keyword, 8
as default
statement, 215
ASCII format, 129
asin
, asinh
, atan
, atanh
functions (Math
), 104
asIntN
, asUintN
functions (BigInt
), 105
assign
function (Object
), 226, 231
async
/await
statements, 8, 197, 197–202
concurrent, 201
throwing/catching exceptions in, 202
with module imports, 213
AsyncFunction
class, 199
asynchronous programming, 185–202
using generators with, 259–260
asyncIterator
field (Symbol
), 223
b
, B
, in binary literals, 99–100
,
B
, in regular expressions, 127
BCP 47 memo, 170
big integers, 105
big-endian ordering, 163
BigInt
class, 105
binary data, 163
binary numbers, 99
bind
method (Function
), 236
bitwise operators, 39
block statements, 32
boolean
type (TypeScript), 274–275
Boolean values, 12
converting to numbers/strings, 11
returned by predicate functions, 57
Boolishness, 34
labeled, 45
semicolon insertion in, 30
browsers
CORS restrictions in, 217
safety checks in, 192
user preferences in, 180
c
, in regular expressions, 125
C# language
casts in, 279
classes in, 82
scope of variables in, 67
type variance in, 302
C++ language
abstract methods in, 89
catching exceptions in, 71
classes in, 82
concurrent programs in, 185
error objects in, 71
functions in, 9
hash/tree maps in, 158
hexadecimal floating-point literals in, 100
no-argument constructors in, 91
scope of variables in, 67
tree nodes in, 96
call
method (Function
), 236
callback functions, 186
callback hell, 188
catch
method (Promise
), 195, 197
cbrt
, ceil
functions (Math
), 104
characters
combined, 178
encoding, 14
in regular expressions, 123–125
Chinese language, 168
circular references, 234
using new
operator with, 92
anonymous, 91
executed in strict mode, 84
private fields in, 86
static fields/methods in, 86–87
vs. modules, 210
clear
method (Map
), 157
closure pattern, 60
simulating modules through, 210
Common.js module system, 210
compile-time typing, 269
concat
method
of String
, 119
conditional operator, 33
conditional statements, 31
configuration objects, 67, 292–293
and scope of variables, 68
constants, mathematical, 104
constructor
keyword, 83–84, 235
setting object properties in, 85
labeled, 46
semicolon insertion in, 30
control flow statements, 30–33
copyWithin
method (Array
), 145–146
CORS (Cross-Origin Resource Sharing), 192, 217
cos
, cosh
functions (Math
), 104
create
function (Object
), 226, 231–232
Crockford, Douglas, 60
cross-origin errors, 192
currency, displaying, 172
d
, D
, in regular expressions, 124–125
DataView
class, 163
mutability of, 110
now
, parse
functions, 109
set
XXX methods, 109
dates
current, 109
distance between, 108
parsing, 109
ranges of, 174
daylight savings time, 106
debugger
statement, 7
decimal numbers, 99
default values, 38
defineProperties
function (Object
), 226, 228
defineProperty
function
of Reflect
, 242
delete
method
of Map
, 157
of Set
, 158
of WeakMap
/WeakSet
, 160
applied to unqualified identifiers, 61
deleteProperty
method (Reflect
), 239, 242
development tools console
enabling strict mode in, 61
Document.querySelectorAll
method, 250
documentation comments, 6
DOM nodes, attaching properties to, 159
dotAll
property (RegExp
), 125, 128, 133
duck typing, 288
e, mathematical constant, 104
e
, E
, in number literals, 99–100
Eclipse development environment, 4
ECMAScript Internationalization API (ECMA-402), 180
ECMAScript language
specification of, 79
else if
statement, 32
emojis
encoding, 116
in regular expressions, 130
empty string
as a Boolean, 34
converting to numbers/strings, 11
encodeURI
function (String
), 120
endianness, 163
endsWith
method (String
), 116, 119
English language
dates in, 168
string ordering in, 176
entries
method
objects returned by, 250
of Array
, 150
of Map
, 158
of Set
, 159
enum, 7
epoch, 106
equality testing, 35
error objects, 71
escape sequences, 13
every
method (Array
), 147, 149, 151
exceptions
exec
method (RegExp
), 130–131, 133–134
exp
, expm1
functions (Math
), 104
export default
statement, 214–215
expression statements, 28
f
, in regular expressions, 125
factory class pattern, 60
factory functions, 78
invoking, 81
parameters in, 60
failures, 69
fetch
function (Promise
), 192–193
fields
private, 86
private static, 87
File API, 163
file://
URLs, 211
filter
method (Array
), 56–57, 147, 150–152, 225
find
, findIndex
methods (Array
), 147, 149, 151
firstIndex
method (Array
), 147
flags
property (RegExp
), 128, 133
flat
method (Array
)
of typed arrays, 162
flatMap
method
of typed arrays, 162
floating-point numbers, 8, 99–100
Float
XXXArray
classes, 160–161
floor
function (Math
), 39, 104
Flow type checker, 270
for await of
statement, 201, 261–263
for each
loop (Java), 43
and legacy libraries, 44
for arrays, 150
iterating over a string, 44
for
method (Symbol
), 222
for of
statement, 42, 249–251, 253, 255, 262
for arrays, 150
for sets, 159
forEach
method
of Map
, 157
of Set
, 159
format
method
of Intl.DateTimeFormat
, 173
of Intl.ListFormat
, 179
of Intl.RelativeTimeFormat
, 175
formatRange
method (Intl.DateTimeFormat
), 174
formatToParts
method
of Intl.DateTimeFormat
, 175
of Intl.NumberFormat
, 171
of Intl.RelativeTimeFormat
, 175
freeze
function (Object
), 60, 226, 230
from
function (Array
), 142, 146, 151–152, 250
from
keyword, 8
fromCodePoint
function (String
), 115, 119
fromEntries
function (Object
), 226, 231
fround
, ftrunc
, ffloor
, fceil
functions (Math
), 104
and this
, 78
comparing to arrow functions, 55
default parameters in, 66
for nested functions, 93
rest declarations in, 66
type annotations with, 271
Function
class, 235
apply
method, 237
bind
method, 236
call
method, 236
function literals, 54
functional array processing, 56–57
functional programming languages, 51
functions, 9
applying strict mode to, 61
arrow, 54–55, 78, 93–95, 199, 255
callback, 186
calling, 52
before declaring, 69
flexibly, 295
configuration objects for, 67, 292–293
executing later, 57
higher-order, 53
immediately invoked, 69
mathematical, 104
parameterless, 55
parameters of:
always converted to numbers, 63
annotating, 270
duplicating, 62
named, 66
optional, 291
predicate, 57
storing in variables, 53
terminating, 52
type tests for, 63
vs. classes in Java/C++, 82
g
flag, in regular expressions, 128, 131
garbage collection, 160
of proxies, 242
get
method
of Map
, 157
of WeakMap
, 160
getCanonicalLocales
method (Intl
), 180
getInt
XXX, getUInt
XXX, getFloat
XXX methods (DataView
), 163
getOwnProperty
XXX functions
of Object
, 226, 228–230, 232, 239
of proxies, 242
getPrototypeOf
function
of Object
, 80, 226, 231–232, 239
of proxies, 242
overriding, 90
static, 87
getUTC
XXX, get
XXX methods (Date
), 107, 109
getYear
method (Date
), obsolete, 109
global
property (RegExp
), 128, 131, 133
Greek letters, 122
groups
property (RegExp
), 133
Gulliver’s Travels, 163
Hanafuda playing cards, 187
has
method
of Map
, 157
of proxies, 242
of WeakMap
/WeakSet
, 160
hasInstance
field (Symbol
), 223
hasOwnProperty
method (Object
), 226, 230
hexadecimal numbers, 99
higher-order functions, 53
HTML (HyperText Markup Language)
building lists from arrays in, 56
canvas images in, 161
escaping characters in, 56
hyperlinks in, 123
HTMLCollection
collection, 141
hyperbolic functions, 104
hypot
function (Math
), 104
i
flag, in regular expressions, 127–128
unqualified, 61
IEEE 754 standard, 99
vs. switch
, 40
ignoreCase
property (RegExp
), 127–128, 133
images
in HTML canvas, 161
immediately invoked functions, 69
import.meta
object, 217
in TypeScript, 279
includes
method
index
property (Array
), 143
indexOf
method
of Array
, 149
infer
keyword, 303
input
property (Array
), 143
instanceof
operator, 7, 89, 232
integers, 99
big, 105
no explicit type for, 8
rounding numbers to, 9
interface
keyword, 8
internal slots, 79
Internet Engineering Task Force, 170
Intl.Collator
class, 177
resolvedOptions
method, 181
supportedLocalesOf
method, 180
Intl.DateTimeFormat
class
format
method, 173
formatRange
method, 174
formatToParts
method, 175
supportedLocalesOf
method, 180
Intl.DisplayNames
class, 180
Intl.getCanonicalLocales
method, 180
Intl.ListFormat
class, 179
select
method, 179
supportedLocalesOf
method, 180
Intl.NumberFormat
class
formatToParts
method, 171
supportedLocalesOf
method, 180
Intl.PluralRules
class, 178–179
select
method, 178
supportedLocalesOf
method, 180
Intl.RelativeTimeFormat
class, 175
format
, formatToParts
methods, 175
supportedLocalesOf
method, 180
is
function (Object
), 35
isArray
function (Array
), 279
isConcatSpreadable
field (Symbol
), 149, 223
isExtensible
function (Object
), 226, 230, 239
isFinite
function
global, 102
isFrozen
function (Object
), 226, 230
isInteger
function (Number
), 102
isNaN
function
global, 102
ISO 8601 format, 106
isPrototypeOf
method (Object
), 226, 232
isSafeInteger
function (Number
), 102–103
isSealed
function (Object
), 226, 230
async, 261
Japanese imperial calendar, 169
Java language
abstract methods in, 89
captured variables in, 58
casts in, 279
catching exceptions in, 71
classes in, 82
concurrent programs in, 185
Date
class in, 106
error objects in, 71
extends
keyword in, 89
for each
loop in, 43
hash/tree maps in, 158
hexadecimal floating-point literals in, 100
no-argument constructors in, 91
packages in, 210
scope of variables in, 67
tree nodes in, 96
type variance in, 302
JavaScript language
functional, 51
stage 3 proposal, 38, 86–87, 100, 134, 171, 173, 180–181, 197, 217, 284
stage 4 proposal, 213
join
method (Array
), 56, 119, 147, 151–152
.js
extension, 217
JSDoc tool, 6
JSON (JavaScript Object Notation), 20–21
asynchronous processing of, 199
jump tables, 40
key/value pairs, 156
keys
method
objects returned by, 250
of Map
, 158
of Object
, 226, 229, 239, 243–244
of Set
, 159
Komodo development environment, 4
labeled breaks, 45
lastIndex
method (Array
), 147
lastIndex
property (RegExp
), 131
lastIndexOf
method
of Array
, 149
language, 122
lazy evaluations, 37
leap seconds, 105
length
property (Array
), 143
letters
in regular expressions, 130
light-server
http server, 187
LinkedHashMap
(Java), 157
little-endian ordering, 163
loadImage
function (Promise
), 192
localeCompare
method (String
), 147, 176–178
displaying, 180
tags for, 180
time in, 172
log
, log2
, log10
, log1p
functions (Math
), 104
lookahead/lookbehind operators, 137
condition values for, 34
lowercase letters
in regular expressions, 130
lvalues, 22
m
flag, in regular expressions, 128
map
method (Array
), 56, 147, 151, 153, 225
Map
class, 156
generic, 298
size
property of, 157
adding/removing entries of, 157
empty, 157
iterating over, 250
keys of, 157
traversing, 157
weak, 160
match
, matchAll
fields (Symbol
), 223
match
, matchAll
methods (String
), 120, 131, 134
constants of, 104
functions of, 104
random
, 104
round
, 104
Maven artifacts, 211
default values for, 38
intersepting invocations of, 237
invoked:
with invalid arguments, 46
without an object, 92
private, 86
private static, 87
setting object properties in, 85
with async
, 199
Microsoft, 269
.mjs
extension, 217
circular dependencies between, 215–216
default feature of, 211
exported vs. private features of, 209
loading asynchronously, 210
named features in, 212
packaging, 217
processing, 217
URLs for, 211
vs. classes/closures, 210
n
, in big integers, 105
, in regular expressions, 125
name conflicts, 210
named arguments, 66
arithmetic operations with, 10–11
assigning new values to, 61
checking for, 102
navigator.languages
property, 180
never
type (TypeScript), 274–275
new
operator, 7, 81–82, 84, 231
missing in a constructor function, 92
with Array
, 142
with maps, 157
next
method (iterators), 250, 261
Node.js
enabling strict mode in, 61
rejected promises in, 202
NodeList
collection, 141
normalize
method (String
), 178
Norwegian language, 169
now
function (Date
), 109
npm
package manager, 272
null
type (TypeScript), 274–275
arithmetic operations with, 11
checking values for, 38
converting to numbers/strings, 11
isInteger
function, 102
isSafeInteger
function, 102–103
parseFloat
, parseInt
functions, 8–9, 46, 101–102
toExponential
, toFixed
, toPrecision
methods, 100, 103
toLocaleString
method, 171–172
toString
function, 9, 82, 100, 103
number
type (TypeScript), 273–275
number[]
type (TypeScript), 273
comparing, 34
converting:
dividing by zero, 9
finding largest/smallest of, 103
formatting, 100, 167–168, 171–172
in regular expressions, 130
removing fractional part of, 39
type tests for, 63
Nynorsk standard, 169
o
, O
, in octal literals, 99–100
obj.__proto__
notation, 80
Object
class, 77
defineProperties
function, 226, 228
defineProperty
function, 226–227, 239, 242
fromEntries
function, 226, 231
getOwnProperty
XXX functions, 226, 228–230, 232, 239
getPrototypeOf
function, 80, 226, 231–232, 239
hasOwnProperty
method, 226, 230
is
function, 35
isExtensible
function, 226, 230, 239
isPrototypeOf
method, 226, 232
keys
method, 226, 229, 239, 243–244
preventExtensions
function, 226, 230, 239
propertyIsEnumerable
method, 226, 230
setPrototypeOf
function, 80, 226, 231, 239
toLocaleString
method, 170
object literals, 17
object-oriented programming languages, 77
inheritance in, 87
array-like, 142
as map keys, 158
attaching properties to, 222
comparing, 35
converting to numbers/strings, 11
creating, 231
immutable, 230
internal slots of. See prototypes
keys of, 221
nested, 23
properties of. See properties
protecting, 230
wrapper, 5
regular expressions for, 132
of
function
of typed arrays, 161
of
keyword, 8
offending tokens, 29
One True Brace Style (1TBS), 32
operators
bitwise, 39
greedy, 136
shift, 39
ORM (object-relational mapper), 237
p
, P
, in regular expressions, 125
package
statement, 8
package.json
file, 217
padStart
, padEnd
methods (String
), 118–119
parse
function (Date
), 109
parseFloat
, parseInt
functions (Number
), 8, 101–102
polymorphism, 90
predefined character classes, 124–126
predicate functions, 57
preventExtensions
function (Object
), 226, 230, 239
primitive types, 5
controlling conversion on, 224–225
printf
function (C), 101
private
keyword, 8
private properties, 59
programming
asynchronous, 185–202, 259–260
functional, 51
object-oriented, 77
any
method, 197
loadImage
function, 192
race
method, 197
resolve
method, 189–191, 193–195
multiple:
executing, 196
racing, 197
rejected, 190–191, 194–197, 202
settled, 190
immediately, 191
properties (of objects)
common to multiple objects, 79
descriptors of, 227
iterating over, 43
writing to, 81
propertyIsEnumerable
method (Object
), 226, 230
protected
keyword, 8
prototype chain, 81, 88, 229, 231
[[Prototype]] internal slot, 82
accessing, 231
setting, 80
updating, 231
checking return values of, 242
Proxy.revocable
function, 239
public
keyword, 8
punctuation, in regular expressions, 130
QED text editor, 124
querySelectorAll
method (Document
), 250
, in regular expressions, 125
race
method (Promise
), 197
random
function (Math
), 104
RangeError
, 162
raw
property (String
), 122
readonly
property (TypeScript), 285, 303
reduce
method (Array
), 153–156
reduceRight
method (Array
), 153, 155
flags
property, 133
groups
property, 133
lastIndex
property, 131
regular expression literals, 127
for numbers, 101
lookahead/lookbehind operators in, 137
reserved characters in, 123–125
reject
method (Promise
), 189–191
repeat
method (String
), 118–119
REPL (“read-eval-print” loop), 28
replace
method
of Symbol
, 223
resolve
method (Promise
), 189–191, 193–195
resolvedOptions
method (Intl.Collator
), 181
rest declarations, 23–24, 64–66
return
method (iterators), 252–253, 258
return
statement, 7
in arrow functions, 55
in function declarations, 52–53
semicolon insertion in, 30, 53
reverse
method (Array
), 145–146
revocable
method (Proxy
), 239
round
function (Math
), 104
roundoff errors, 8
run-time errors, 6
s
flag, in regular expressions, 128
s
, S
, in regular expressions, 124, 126
script
element (HTML), 217
seal
function (Object
), 226, 230
search
method
of Symbol
, 223
select
method (Intl.PluralRules
), 178
semicolon insertion, 28–31, 53
add
method, 158
delete
method, 158
entries
method, 159
forEach
method, 159
generic, 298
keys
method, 159
size
property, 158
values
method, 159
set
method
of Map
, 157
of typed arrays, 162
of WeakMap
/WeakSet
, 160
setInt
XXX, setUInt
XXX, setFloat
XXX methods (DataView
), 163
setPrototypeOf
function (Object
), 80, 226, 231, 239
iterating over, 250
order of entries in, 159
weak, 160
overriding, 90
static, 87
setTimeout
function, 57
shift
method (Array
), 144, 146
shift operators, 39
sign
function (Math
), 104
sin
, sinh
functions (Math
), 104
size
property
of Map
, 157
of Set
, 158
slice
method
some
method (Array
), 147, 149–151
sort
method (Array
), 145–147, 152, 176
species
field (Symbol
), 222–223, 225
splice
method (Array
), 144–146, 225
split
method
of Symbol
, 223
spread operator, 65–66, 115, 231, 250
for cloning, 232
sqrt
function (Math
), 104, 276
stack trace, 71
startsWith
method (String
), 116, 119
block, 32
conditional, 31
expression, 28
terminated with semicolons, 29–31
sticky
property (RegExp
), 128, 131, 133
strict equality, 35
creating variables in, 7
enabling, 61
for classes, 84
for modules, 217
forbidden keywords in, 8
missing new
operator in, 92
property attributes in, 227
String
class
concat
method, 119
fromCodePoint
function, 115, 119
localeCompare
method, 147, 176–178
match
, matchAll
methods, 120, 131, 134
normalize
method, 178
padStart
, padEnd
methods, 118–119
raw
property, 122
substring
method, 116
toLocale
XXXCase
methods, 177
toLowerCase
, toUpperCase
methods, 118, 120
trim
, trimStart
, trimEnd
methods, 118–119
string
type (TypeScript), 274–275
stringify
method (JSON
), 20
strings
concatenating, 10–11, 119, 270
converting:
from/to code points, 115
to numbers, 8, 11, 36, 92, 101
extracting substrings from, 9
numeric, 177
patterns for. See regular expressions
replacing, 120
type tests for, 63
with embedded expressions. See template literals
strong
element (HTML), 121
subarray
method
of Array
, 225
of typed arrays, 162
substring
method (String
), 116–117
superclasses, 87
constructors of, 237
supportedLocalesOf
method (Intl.XXX
), 180
Symbol
class, 221
asyncIterator
field, 223
for
method, 222
hasInstance
field, 223
isConcatSpreadable
field, 223
iterator
field, 222–223, 250–253
match
, matchAll
fields, 223
replace
field, 223
search
field, 223
split
field, 223
toStringTag
field, 223
symbol
type (TypeScript), 274–275
creating, 221
global, 222
in regular expressions, 130
properties of, 223
uniqueness of, 222
T
, in dates, 106
, in regular expressions, 125
tag functions, 121
tan
, tanh
functions (Math
), 104
target
keyword, 8
test
method (RegExp
), 130, 133
then
method (Promise
), 192–197
and calls to super
, 90
binding, 236
for object properties, 85
in constructor functions, 81–83
in TypeScript, 286
vs. captured variables, 60
with arrays, 151
threads, 185
throw
method (iterators), 258–259
semicolon insertion in, 30
time
daylight savings, 106
formatting, 175
measuring, 105
representing in computer, 106
time-consuming operations, 186
timeout, 57
™
(trademark symbol), 178
toExponential
, toFixed
, toPrecision
methods (Number
), 100, 103
toLocaleString
method
of Object
, 170
toLocale
XXXCase
methods (String
), 177
toLowerCase
, toUpperCase
methods (String
), 118, 120
toPrimitive
field (Symbol
), 223–225
toString
method
of Date
, 110
toStringTag
field (Symbol
), 223
to
XXXString
methods (Date
), 107, 110
trailing comma
in arrays, 19
in object literals, 17
trigonometric functions, 104
trim
, trimStart
, trimEnd
methods (String
), 118–119
try
statement, 7, 46–47, 70–73
type parameters, 297
generic, 302
with arrays, 19
with regular expressions, 127
with symbols, 222
types, 5
controlling conversion on, 224–225
of function parameters, 52, 62–63
testing, 63
composite types in, 273, 275–277
string[]
, 275
union, 270, 273, 276, 279, 296
conditional types in, 303
covariance in, 283
enumerated types in, 275
functions in, 276
destructuring parameters of, 292–293
type guard, 279
in
statement in, 279
instanceof
operator in, 279, 301
intersection types in, 276
object types in, 276
optional parameters in, 291–292
optional/excess properties in, 281–282
private/protected modifiers in, 285
tuple types in, 275
type aliases in, 273
type assertion in, 279
type inference in, 277
type variance in, 302
u
flag, in regular expressions, 128–129
u{. . .}
notation, of code points, 14
in regular expressions, 125, 129
undefined
type (TypeScript), 274–275
arithmetic operations with, 11
as function return value, 52
assigning new values to, 61
checking values for, 38
comparing to, 35
converting to:
numbers/strings, 11
for function parameters, 64
undefined
variable, 13
unicode
property (RegExp
), 128–129, 133
Unicode, 14
combined characters in, 178
in regular expressions, 128–130
normalization forms in, 178
union type (TypeScript), 270, 273, 276, 279, 296
unknown
type (TypeScript), 274–275
unqualified identifiers, 61
unshift
method (Array
), 144, 146
uppercase letters
in regular expressions, 130
URLs
(backslashes) in, 122
for modules, 211
safe characters for, 120
UTC (Coordinated Universal Time), 106, 109
UTF-16 encoding, 116
v
, in regular expressions, 125
values
default, 38
finding type of, 5
values
method
objects returned by, 250
of Map
, 158
of Set
, 159
var
statement (obsolete), 7
variable declarations, 6–7, 27
variables
default values of, 24
never chaining, 6
storing functions in, 53
untyped, 6
Visual Studio Code development environment, 4, 272
void
keyword, 7
w
, W
, in regular expressions, 124, 126
WeakMap
class, 160
generic, 298
WeakSet
class, 160
web servers, local, 187
WebSocket API, 163
WebStorm development environment, 4
whitespace
in regular expressions, 130
wrapper objects, 5
x
, X
, in hexadecimal literals, 99–100
x
, in regular expressions, 125
XMLHttpRequest
class, 186, 259
yielding array buffers, 163
y
flag, in regular expressions, 128, 131
semicolon insertion in, 30
shallowness of, 255
Zawinski, Jamie, 137
zero. See 0