GeezerVison is showing github.com — Add chapter basic (comments, syntax, ...) · guptag-dev/javascript@d26488e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: README.md +4-1Lines changed: 4 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,4 +3,7 @@ Learn Javascript | 3 | 3 |
| 4 | 4 | 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. | 5 | 5 |
| 6 | | -JavaScript (*JS for short*) is the programming language that enables web pages to respond to user interaction beyond the basic level. | | 6 | +JavaScript (*JS for short*) is the programming language that enables web pages to respond to user interaction beyond the basic level. It was been created in 1995, and is today one of the most famous and used programing languages. | | 7 | + | | 8 | + | | 9 | +**Note:** This book was been generated using [GitBook](http://www.gitbook.io) and is open source, feel free to contribute or signal issues on [GitHub](https://github.com/GitbookIO/javascript). |
Collapse file Copy file name to clipboardExpand all lines: SUMMARY.md +4-2Lines changed: 4 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # Summary | 2 | 2 |
| 3 | | -* [Variables](variables/README.md) | 4 | | - * [Types](variables/types.md) | | 3 | +* [Basics](basics/README.md) | | 4 | + * [Comments](basics/comments.md) | | 5 | + * [Variables](basics/variables.md) | | 6 | + * [Types](basics/types.md) | 5 | 7 | * [Numbers](numbers/README.md) | 6 | 8 | * [Creation](numbers/create.md) | 7 | 9 | * [Basic Operators](numbers/operators.md) | |
Collapse file Copy file name to clipboard +19Lines changed: 19 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# Basics about Programming | | 2 | + | | 3 | +In this first chapter, we'll learn the basics of programming and the Javascript language. | | 4 | + | | 5 | +Programming means writting code. Much like a book is made up of chapters, paragraphs, sentences, phrases, words and finally punctuation and letters, so too is a program 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. | | 6 | + | | 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. | | 8 | + | | 9 | +Here is a simple example: | | 10 | + | | 11 | +```js | | 12 | +var hello = "Hello"; | | 13 | +var world = "World"; | | 14 | + | | 15 | +// Message equals "Hello World" | | 16 | +var message = hello + " " + world; | | 17 | +``` | | 18 | + | | 19 | +This code can be executed by another program called an *interpreter* taht will read the code, and execute all the statements in teh right order. |
Collapse file Copy file name to clipboard +43Lines changed: 43 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# Comments | | 2 | + | | 3 | +Comments are statements that will not be executed by the interpreter, comments are used to mark anotations for others programmers or to make it easy to understand your code in the future. | | 4 | + | | 5 | +In Javascript, comments can be written in 2 different ways: | | 6 | + | | 7 | +* Line starting with `//`: | | 8 | + | | 9 | +```js | | 10 | +// This is a comment, it will be ignored by the interpreter | | 11 | +var a = "this is a variable defined in a statement"; | | 12 | +``` | | 13 | + | | 14 | +* Section of code starting by `/*`and finishing by `*/`, this method is used for multi-lines comments: | | 15 | + | | 16 | +```js | | 17 | +/* | | 18 | +This is a multi-lines comment, | | 19 | +it will be ignored by the interpreter | | 20 | +*/ | | 21 | +var a = "this is a variable defined in a statement"; | | 22 | +``` | | 23 | + | | 24 | + | | 25 | +--- | | 26 | + | | 27 | +Mark the all editor content as a comment | | 28 | + | | 29 | +```js | | 30 | +Mark me as a comment | | 31 | +or I'll throw an error | | 32 | +``` | | 33 | +
| | 34 | +```js | | 35 | +/*Mark me as a comment | | 36 | +or I'll throw an error*/ | | 37 | +``` | | 38 | + | | 39 | +```js | | 40 | +assert(true); | | 41 | +``` | | 42 | + | | 43 | +--- |
Collapse file Copy file name to clipboard - Display the source diff
- Display the rich diff
File renamed without changes. Collapse file Copy file name to clipboardExpand all lines: basics/variables.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | # Variables | 2 | 2 |
| 3 | | -The first step towards understanding programming is looking back at algebra. If you remember from school, algebra starts with writing terms such as the following. | | 3 | +The first step towards really understanding programming is looking back at algebra. If you remember from school, algebra starts with writing terms such as the following. | 4 | 4 |
| 5 | 5 | ``` | 6 | 6 | 3 + 5 = 8 | |
Collapse file Copy file name to clipboardExpand all lines: comments/README.md - Display the source diff
- Display the rich diff
|