Skip to content

Commit 16d278c

Browse files
author
James Halliday
committed
fix javascript formatting
1 parent 5542ba4 commit 16d278c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

javascript.markdown

+18-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
javascript is a programming language
44
you can use to program web pages
55
and command-line tools and servers
6+
67
---
78
# install node
89

@@ -12,6 +13,7 @@ to learn javascript.
1213
Download and install node from:
1314

1415
https://nodejs.org
16+
1517
---
1618
# write a program
1719

@@ -48,6 +50,7 @@ Note the single quotes on each side.
4850
You can use double quotes too: `"BEEP BOOP"`
4951

5052
Sometimes an "argument" is called a "parameter".
53+
5154
---
5255
# statements
5356

@@ -85,6 +88,7 @@ is rare in practice.
8588

8689
Both including and omitting semicolons
8790
are popular code styles.
91+
8892
---
8993
# variables
9094

@@ -115,6 +119,7 @@ Variables are containers that can hold values.
115119

116120
Strings like `'beep'` and numbers like `5`
117121
are values.
122+
118123
---
119124
# operators
120125

@@ -150,6 +155,7 @@ Then type an expression and you will see its result:
150155
```
151156

152157
Type ctrl+d to exit the REPL.
158+
153159
---
154160
# assignment updates
155161

@@ -191,6 +197,7 @@ do an update "in place":
191197
* `*=` - multiply in place
192198
* `/=` - divide in place
193199
* `%=` - modulo in place
200+
194201
---
195202
# increment, decrement
196203

@@ -205,6 +212,7 @@ Same as: `x += 1` or `x = x + 1`
205212
You might also see `++x` and `--x` which
206213
are similar to `x++` and `x--` but have
207214
slightly different uses. More on them later.
215+
208216
---
209217
# booleans
210218

@@ -228,6 +236,7 @@ You might also see coercive equality operators:
228236

229237
but you should avoid these operators until
230238
learning about type coercion.
239+
231240
---
232241
# comparison operators: example
233242

@@ -437,14 +446,14 @@ if (true) {
437446
---
438447
# first rule of indentation
439448

440-
However you choose to indent,
441-
be consistent!
449+
However you choose to indent, be consistent!
442450

443451
Your code will be much easier for others and yourself to
444452
read.
445453

446454
Remember to line up closing braces at the same level as
447455
opening statements!
456+
448457
---
449458
# arrays
450459

@@ -533,6 +542,7 @@ been defined by the language itself.
533542

534543
Later we'll see how to inspect what
535544
methods are available.
545+
536546
---
537547
# arrays: pop
538548

@@ -703,6 +713,7 @@ var obj = {
703713

704714
This way of building objects is sometimes called
705715
"object literal" syntax.
716+
706717
---
707718
# objects: pick out a single record
708719

@@ -815,6 +826,7 @@ prints:
815826

816827
Everything we can do with dot (updates, assignment
817828
operators, etc) works with square bracket notation.
829+
818830
---
819831
# objects: delete
820832

@@ -834,6 +846,7 @@ prints:
834846

835847
If you try to delete a key that doesn't exist, nothing
836848
happens.
849+
837850
---
838851
# Object.keys
839852

@@ -1295,6 +1308,7 @@ BEEP BOOP
12951308
* number to hex string: `(123).toString(16) === '7b'
12961309
* binary string to number: `parseInt('1111011',2) === 123`
12971310
* hex string to number: `parseInt('7b',16) === 123`
1311+
12981312
---
12991313
# JSON: stringify
13001314
@@ -1356,6 +1370,7 @@ prints:
13561370
log base 2 of 255 = `Math.log(255) / Math.log(2)`
13571371
13581372
[read more](http://mzl.la/148HnQj)
1373+
13591374
---
13601375
# builtin: Date
13611376
@@ -1391,6 +1406,7 @@ console.log([ d.getFullYear(), d.getMonth(), d.getDay() ])
13911406

13921407
console.log([ d.getHours(), d.getMinutes(), d.getSeconds() ])
13931408
// [ 10, 18, 26 ]
1409+
```
13941410
---
13951411
# homework
13961412

0 commit comments

Comments
 (0)