Skip to content

Commit 7608deb

Browse files
committed
run prettier and fix typos
1 parent 3f47b42 commit 7608deb

37 files changed

+327
-336
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
.grunt
33
/_book/
4+
.vscode

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
Learn Javascript
2-
======
1+
# Learn Javascript
32

43
This book will teach you the basics of programming and Javascript. Whether you are an experienced programmer or not, this book is intended for everyone who wishes to learn the JavaScript programming language.
54

65
![Screen](./assets/intro.png)
76

8-
JavaScript (*JS for short*) is the programming language that enables web pages to respond to user interaction beyond the basic level. It was created in 1995, and is today one of the most famous and used programming languages.
7+
JavaScript (_JS for short_) is the programming language that enables web pages to respond to user interaction beyond the basic level. It was created in 1995, and is today one of the most famous and used programming languages.

SUMMARY.md

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
11
# Summary
22

3-
* [Basics](basics/README.md)
4-
* [Comments](basics/comments.md)
5-
* [Variables](basics/variables.md)
6-
* [Types](basics/types.md)
7-
* [Equality](basics/equality.md)
8-
* [Numbers](numbers/README.md)
9-
* [Creation](numbers/create.md)
10-
* [Basic Operators](numbers/operators.md)
11-
* [Advanced Operators](numbers/advanced.md)
12-
* [Strings](strings/README.md)
13-
* [Creation](strings/create.md)
14-
* [Concatenation](strings/concat.md)
15-
* [Length](strings/length.md)
16-
* [Conditional Logic](conditional/README.md)
17-
* [If](conditional/if.md)
18-
* [Else](conditional/else.md)
19-
* [Comparators](conditional/comparators.md)
20-
* [Concatenate](conditional/concatenate.md)
21-
* [Arrays](arrays/README.md)
22-
* [Indices](arrays/indices.md)
23-
* [Length](arrays/length.md)
24-
* [Loops](loops/README.md)
25-
* [For](loops/for.md)
26-
* [While](loops/while.md)
27-
* [Do...While](loops/dowhile.md)
28-
* [Functions](functions/README.md)
29-
* [Declare](functions/declare.md)
30-
* [Higher order](functions/higher_order.md)
31-
* [Objects](objects/README.md)
32-
* [Creation](objects/creation.md)
33-
* [Properties](objects/properties.md)
34-
* [Mutable](objects/mutable.md)
35-
* [Reference](objects/reference.md)
36-
* [Prototype](objects/prototype.md)
37-
* [Delete](objects/delete.md)
38-
* [Enumeration](objects/enumeration.md)
39-
* [Global footprint](objects/global_footprint.md)
40-
3+
- [Basics](basics/README.md)
4+
- [Comments](basics/comments.md)
5+
- [Variables](basics/variables.md)
6+
- [Types](basics/types.md)
7+
- [Equality](basics/equality.md)
8+
- [Numbers](numbers/README.md)
9+
- [Creation](numbers/create.md)
10+
- [Basic Operators](numbers/operators.md)
11+
- [Advanced Operators](numbers/advanced.md)
12+
- [Strings](strings/README.md)
13+
- [Creation](strings/create.md)
14+
- [Concatenation](strings/concat.md)
15+
- [Length](strings/length.md)
16+
- [Conditional Logic](conditional/README.md)
17+
- [If](conditional/if.md)
18+
- [Else](conditional/else.md)
19+
- [Comparators](conditional/comparators.md)
20+
- [Concatenate](conditional/concatenate.md)
21+
- [Arrays](arrays/README.md)
22+
- [Indices](arrays/indices.md)
23+
- [Length](arrays/length.md)
24+
- [Loops](loops/README.md)
25+
- [For](loops/for.md)
26+
- [While](loops/while.md)
27+
- [Do...While](loops/dowhile.md)
28+
- [Functions](functions/README.md)
29+
- [Declare](functions/declare.md)
30+
- [Higher order](functions/higher_order.md)
31+
- [Objects](objects/README.md)
32+
- [Creation](objects/creation.md)
33+
- [Properties](objects/properties.md)
34+
- [Mutable](objects/mutable.md)
35+
- [Reference](objects/reference.md)
36+
- [Prototype](objects/prototype.md)
37+
- [Delete](objects/delete.md)
38+
- [Enumeration](objects/enumeration.md)
39+
- [Global footprint](objects/global_footprint.md)

arrays/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ Here is a simple array:
99
```javascript
1010
// 1, 1, 2, 3, 5, and 8 are the elements in this array
1111
var numbers = [1, 1, 2, 3, 5, 8];
12-
```
12+
```

arrays/length.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Arrays have a property called length, and it's pretty much exactly as it sounds, it's the length of the array.
44

55
```javascript
6-
var array = [1 , 2, 3];
6+
var array = [1, 2, 3];
77

88
// Result: l = 3
99
var l = array.length;

basics/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In this first chapter, we'll learn the basics of programming and the Javascript
44

55
Programming means writing code. A book is made up of chapters, paragraphs, sentences, phrases, words and finally punctuation and letters, likewise a program can be broken down into smaller and smaller components. For now, the most important is a statement. A statement is analogous to a sentence in a book. On its own, it has structure and purpose, but without the context of the other statements around it, it isn't that meaningful.
66

7-
A statement is more casually (and commonly) known as a *line of code*. That's because statements tend to be written on individual lines. As such, programs are read from top to bottom, left to right. You might be wondering what code (also called source code) is. That happens to be a broad term which can refer to the whole of the program or the smallest part. Therefore, a line of code is simply a line of your program.
7+
A statement is more casually (and commonly) known as a _line of code_. That's because statements tend to be written on individual lines. As such, programs are read from top to bottom, left to right. You might be wondering what code (also called source code) is. That happens to be a broad term which can refer to the whole of the program or the smallest part. Therefore, a line of code is simply a line of your program.
88

99
Here is a simple example:
1010

@@ -16,4 +16,4 @@ var world = "World";
1616
var message = hello + " " + world;
1717
```
1818

19-
This code can be executed by another program called an *interpreter* that will read the code, and execute all the statements in the right order.
19+
This code can be executed by another program called an _interpreter_ that will read the code, and execute all the statements in the right order.

basics/comments.md

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ Comments are statements that will not be executed by the interpreter, comments a
44

55
In Javascript, comments can be written in 2 different ways:
66

7-
* Line starting with `//`:
7+
- Line starting with `//`:
88

99
```javascript
1010
// This is a comment, it will be ignored by the interpreter
1111
var a = "this is a variable defined in a statement";
1212
```
1313

14-
* Section of code starting with `/*`and ending with `*/`, this method is used for multi-line comments:
14+
- Section of code starting with `/*`and ending with `*/`, this method is used for multi-line comments:
1515

1616
```javascript
1717
/*
@@ -20,28 +20,3 @@ it will be ignored by the interpreter
2020
*/
2121
var a = "this is a variable defined in a statement";
2222
```
23-
24-
25-
---
26-
27-
Mark the editor's contents as a comment
28-
29-
```js
30-
31-
Mark me as a comment
32-
or I'll throw an error
33-
34-
```
35-
36-
```js
37-
/*
38-
Mark me as a comment
39-
or I'll throw an error
40-
*/
41-
```
42-
43-
```js
44-
assert(true);
45-
```
46-
47-
---

basics/equality.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
Programmers frequently need to determine the equality of variables in relation to other variables. This is done using an equality operator.
44

5-
The most basic equality operator is the `==` operator. This operator does everything it can to determine if two variables are equal, even if they are not of the same type.
5+
The most basic equality operator is the `==` operator. This operator does everything it can to determine if two variables are equal, even if they are not of the same type.
66

77
For example, assume:
8+
89
```javascript
910
var foo = 42;
1011
var bar = 42;
1112
var baz = "42";
1213
var qux = "life";
1314
```
1415

15-
`foo == bar` will evaluate to `true` and `baz == qux` will evaluate to `false`, as one would expect. However, `foo == baz` will *also* evaluate to `true` despite `foo` and `baz` being different types. Behind the scenes the `==` equality operator attempts to force its operands to the same type before determining their equality. This is in contrast to the `===` equality operator.
16+
`foo == bar` will evaluate to `true` and `baz == qux` will evaluate to `false`, as one would expect. However, `foo == baz` will _also_ evaluate to `true` despite `foo` and `baz` being different types. Behind the scenes the `==` equality operator attempts to force its operands to the same type before determining their equality. This is in contrast to the `===` equality operator.
1617

17-
The `===` equality operator determines that two variables are equal if they are of the same type *and* have the same value. With the same assumptions as before, this means that `foo === bar` will still evaluate to `true`, but `foo === baz` will now evaluate to `false`. `baz === qux` will still evaluate to `false`.
18+
The `===` equality operator determines that two variables are equal if they are of the same type _and_ have the same value. With the same assumptions as before, this means that `foo === bar` will still evaluate to `true`, but `foo === baz` will now evaluate to `false`. `baz === qux` will still evaluate to `false`.

basics/types.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ Computers are sophisticated and can make use of more complex variables than just
44

55
The most common types are:
66

7-
* **Numbers**
8-
* **Float**: a number, like 1.21323, 4, -33.5, 100004 or 0.123
9-
* **Integer**: a number like 1, 12, -33, 140 but not 1.233
7+
- **Numbers**
108

11-
* **String**: a line of text like "boat", "elephant" or "damn, you are tall!"
9+
- **Float**: a number, like 1.21323, 4, -33.5, 100004 or 0.123
10+
- **Integer**: a number like 1, 12, -33, 140 but not 1.233
1211

13-
* **Boolean**: either true or false, but nothing else
12+
- **String**: a line of text like "boat", "elephant" or "damn, you are tall!"
1413

15-
* **Arrays**: a collection of values like: 1,2,3,4,'I am bored now'
14+
- **Boolean**: either true or false, but nothing else
1615

17-
* **Objects**: a representation of a more complex object
16+
- **Arrays**: a collection of values like: 1,2,3,4,'I am bored now'
1817

19-
* **null**: a variable that contains null contains no valid Number, String, Boolean, Array, or Object
18+
- **Objects**: a representation of a more complex object
2019

21-
* **undefined**: the undefined value is obtained when you use an object property that does not exist, or a variable that has been declared, but has no value assigned to it.
20+
- **null**: a variable that contains null contains no valid Number, String, Boolean, Array, or Object
2221

23-
JavaScript is a *“loosely typed”* language, which means that you don't have to explicitly declare what type of data the variables are. You just need to use the ```var``` keyword to indicate that you are declaring a variable, and the interpreter will work out what data type you are using from the context, and use of quotes.
22+
- **undefined**: the undefined value is obtained when you use an object property that does not exist, or a variable that has been declared, but has no value assigned to it.
23+
24+
JavaScript is a _“loosely typed”_ language, which means that you don't have to explicitly declare what type of data the variables are. You just need to use the `var` keyword to indicate that you are declaring a variable, and the interpreter will work out what data type you are using from the context, and use of quotes.
2425

2526
{% exercise %}
2627
Create a variable named `a` using the keyword `var`.

conditional/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ First of all conditions can be used to ensure that your program works, regardles
66

77
The other thing conditions can do for you is allow for branching. You might have encountered branching diagrams before, for example when filling out a form. Basically, this refers to executing different “branches” (parts) of code, depending on if the condition is met or not.
88

9-
In this chapter, we'll learn the base of conditional logic in Javascript.
9+
In this chapter, we'll learn the base of conditional logic in Javascript.

0 commit comments

Comments
 (0)