Skip to content

Commit d26488e

Browse files
committed
Add chapter basic (comments, syntax, ...)
1 parent 597ffbe commit d26488e

File tree

7 files changed

+71
-4
lines changed

7 files changed

+71
-4
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ Learn Javascript
33

44
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.
55

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).

SUMMARY.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Summary
22

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)
57
* [Numbers](numbers/README.md)
68
* [Creation](numbers/create.md)
79
* [Basic Operators](numbers/operators.md)

basics/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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.

basics/comments.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
---
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Variables
22

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.
44

55
```
66
3 + 5 = 8

comments/README.md

Whitespace-only changes.

0 commit comments

Comments
 (0)