Skip to content

Commit 4f9acdd

Browse files
committed
Integrate editing in Chapter 1
1 parent dc43dc8 commit 4f9acdd

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

01_values.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ thus fundamentally alike.
2424

2525
{{index CD, signal}}
2626

27-
Bits are any kind of two-valued things, usually described as zeros and
27+
_Bits_ are any kind of two-valued things, usually described as zeros and
2828
ones. Inside the computer, they take forms such as a high or low
2929
electrical charge, a strong or weak signal, or a shiny or dull spot on
3030
the surface of a CD. Any piece of discrete information can be reduced
@@ -49,7 +49,7 @@ So that's the binary number 00001101, or 8 + 4 + 1, or 13.
4949

5050
{{index memory, "volatile data storage", "hard drive"}}
5151

52-
Imagine a sea of bits. An ocean of them. A typical modern computer has
52+
Imagine a sea of bits—an ocean of them. A typical modern computer has
5353
more than 30 billion bits in its volatile data storage (working
5454
memory). Nonvolatile storage (the hard disk or equivalent) tends to
5555
have yet a few orders of magnitude more.
@@ -102,9 +102,9 @@ single number value. There are only so many patterns you can make with
102102
represented is limited. For _N_ decimal ((digit))s, the amount of
103103
numbers that can be represented is 10^N^. Similarly, given 64 binary
104104
digits, you can represent 2^64^ different numbers, which is about 18
105-
quintillion (an 18 with 18 zeros after it). This is a lot.
105+
quintillion (an 18 with 18 zeros after it). That's a lot.
106106

107-
Computer memory used to be a lot smaller, and people tended to use
107+
Computer memory used to be much smaller, and people tended to use
108108
groups of 8 or 16 bits to represent their numbers. It was easy to
109109
accidentally _((overflow))_ such small numbers—to end up with a number
110110
that did not fit into the given amount of bits. Today, even computers
@@ -124,7 +124,7 @@ zeros)—which is still pleasantly huge.
124124

125125
{{index [number, notation]}}
126126

127-
Fractional numbers are written by using a dot.
127+
Fractional numbers are written by using a dot:
128128

129129
```
130130
9.81
@@ -133,7 +133,7 @@ Fractional numbers are written by using a dot.
133133
{{index exponent, "scientific notation", [number, notation]}}
134134

135135
For very big or very small numbers, you may also use scientific
136-
notation by adding an "e" (for "exponent"), followed by the exponent
136+
notation by adding an _e_ (for _exponent_), followed by the exponent
137137
of the number:
138138

139139
```
@@ -175,10 +175,10 @@ a new value.
175175

176176
{{index grouping, parentheses, precedence}}
177177

178-
Does the example mean "add 4 and 100, and multiply the result by 11",
178+
But does the example mean "add 4 and 100, and multiply the result by 11,"
179179
or is the multiplication done before the adding? As you might have
180180
guessed, the multiplication happens first. But as in mathematics, you
181-
can change this by wrapping the addition in parentheses.
181+
can change this by wrapping the addition in parentheses:
182182

183183
```
184184
(100 + 4) * 11
@@ -239,7 +239,7 @@ result.
239239
{{index syntax, text, character, [string, notation], "single-quote character", "double-quote character", "quotation mark", backtick}}
240240

241241
The next basic data type is the _((string))_. Strings are used to
242-
represent text. They are written by enclosing their content in quotes.
242+
represent text. They are written by enclosing their content in quotes:
243243

244244
```
245245
`Down on the sea`
@@ -257,7 +257,7 @@ Almost anything can be put between quotes, and JavaScript will make a
257257
string value out of it. But a few characters are more difficult. You
258258
can imagine how putting quotes between quotes might be hard.
259259
_Newlines_ (the characters you get when you press Enter) may only be
260-
included when the string is quoted with backtick (`` ` ``), the other
260+
included when the string is quoted with backtick (`` ` ``). The other
261261
types of strings have to stay on a single line.
262262

263263
{{index [escaping, "in strings"], "backslash character"}}
@@ -307,10 +307,11 @@ numbers.
307307
{{index "UTF-16", emoji}}
308308

309309
And that's what JavaScript does. But there's a complication:
310-
JavaScript's representation uses 16 bits per string element, and there
311-
are more than 2^16^ different characters in Unicode (about twice as
312-
many, at this point). So some characters, such as many emoji, take up
313-
two "character positions" in JavaScript strings.
310+
JavaScript's representation uses 16 bits per string element, which can
311+
fit 2^16^ different numbers. But Unicode defines more characters than
312+
that—about twice as many, at this point. So some characters, such as
313+
many emoji, take up two "character positions" in JavaScript strings.
314+
We'll come back to this in [Chapter ?](higher_order#code_units).
314315

315316
{{index "+ operator", concatenation}}
316317

@@ -323,7 +324,7 @@ produce the string `"concatenate"`:
323324
"con" + "cat" + "e" + "nate"
324325
```
325326

326-
String values have a number of associated functions (_methods_), that
327+
String values have a number of associated functions (_methods_) that
327328
can be used to perform other operations on them. We'll come back to
328329
these in [Chapter ?](data#methods).
329330

@@ -419,7 +420,7 @@ console.log("Aardvark" < "Zoroaster")
419420

420421
The way strings are ordered is roughly alphabetic, but not really what
421422
you'd expect to see in a dictionary: uppercase letters are always
422-
"less" than lowercase ones, so `"Z" < "a"`, and non-alphabetic
423+
"less" than lowercase ones, so `"Z" < "a"`, and nonalphabetic
423424
characters (!, -, and so on) are also included in the ordering. When
424425
comparing strings, JavaScript goes over the characters from left to
425426
right, comparing the ((Unicode)) codes one by one.
@@ -542,7 +543,7 @@ recommend treating them as mostly interchangeable.
542543

543544
{{index NaN, "type coercion"}}
544545

545-
In the introduction, I mentioned that JavaScript goes out of its way
546+
In the Introduction, I mentioned that JavaScript goes out of its way
546547
to accept almost any program you give it, even programs that do odd
547548
things. This is nicely demonstrated by the following expressions:
548549

@@ -624,7 +625,7 @@ using the shorter operators.
624625
The logical operators `&&` and `||` handle values of different types
625626
in a peculiar way. They will convert the value on their left side to
626627
Boolean type in order to decide what to do, but depending on the
627-
operator and the result of that conversion, they return either the
628+
operator and the result of that conversion, they will return either the
628629
_original_ left-hand value or the right-hand value.
629630

630631
{{index "|| operator"}}

0 commit comments

Comments
 (0)