Skip to content

Commit a890269

Browse files
committedMar 19, 2021
Adding module #7, removing extra img, fixing spelling errors
1 parent e0e2bc4 commit a890269

12 files changed

+1620
-701
lines changed
 

‎01_basics.md

+64-41
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<a name="basics.md"></a>
2+
23
# **Module #1 - The Basics**
4+
35
---
46

57
<a name="loading"></a>
8+
69
## **LOADING AND RUNNING JAVASCRIPT**
710

811
add `<script>` tag just before the `</body>` tag.
@@ -17,6 +20,7 @@ add `<script>` tag just before the `</body>` tag.
1720
<br>
1821

1922
<a name="variables"></a>
23+
2024
## **VARIABLES**
2125

2226
- **var** (_value can be updated_)
@@ -30,11 +34,14 @@ const cool = true;
3034
```
3135

3236
<a name="typpeOfVariables"></a>
37+
3338
## **TYPE OF VARIABLES:**
3439

3540
<a name="strings"></a>
36-
- ### String:
37-
represent letter, pharagraphs, phases, etc. Can be declared with quotes, double-quotes or back ticks.
41+
42+
- ### String:
43+
44+
represent letter, paragraphs, phases, etc. Can be declared with quotes, double-quotes or back ticks.
3845

3946
```js
4047
const name = "Wes";
@@ -43,51 +50,60 @@ const cool = true;
4350
```
4451

4552
sentence
46-
with "\ esc", quotes, single quotes and backtip option:
53+
with "\ esc", quotes, single quotes and backtick option:
4754
sentence = She´s so "cool"
4855

4956
```js
5057
const sentence = 'she´s so "cool"';
51-
const sentence = "she´s so \"cool\"";
58+
const sentence = 'she´s so "cool"';
5259
const sentence = `She's so "cool"`;
5360
```
54-
contatenation & interpolation
61+
62+
concatenation & interpolation
63+
5564
```js
56-
const hello = `hello my name is ${variable_name} nice yo meet you. I'm ${30 + 5} years old`
65+
const hello = `hello my name is ${variable_name} nice yo meet you. I'm ${
66+
30 + 5
67+
} years old`;
5768
```
5869

5970
<a name="numbers"></a>
60-
- ### Numbers:
71+
72+
- ### Numbers:
73+
6174
Numbers on Javascript includes float, integers, etc ...
62-
there are all the basic operation (addition, substraction, multiplication and division).
75+
there are all the basic operation (addition, subtraction, multiplication and division).
6376

6477
```js
65-
let a = 10 + 10 // addition
66-
let b = 20 - 10 // subtraction
67-
let c = 10 * 10 // multiplication
68-
let d = 100 / 10 // division
69-
let e = 1000 % 3 // modulo
78+
let a = 10 + 10; // addition
79+
let b = 20 - 10; // subtraction
80+
let c = 10 * 10; // multiplication
81+
let d = 100 / 10; // division
82+
let e = 1000 % 3; // modulo
7083
```
71-
Javascript have helper methods like:
72-
84+
85+
Javascript have helper methods like:
86+
7387
```js
74-
Math.round(20.5) //result 21, round number up or down
75-
Math.floor(20.2) //result 20, will give you the lower
76-
Math.ciel(20.9) // result 21, will give you the upper
77-
Math.random() // gives random number between 0 and 1
88+
Math.round(20.5); //result 21, round number up or down
89+
Math.floor(20.2); //result 20, will give you the lower
90+
Math.ceil(20.9); // result 21, will give you the upper
91+
Math.random(); // gives random number between 0 and 1
7892
```
7993

8094
NaN is an other number, that means _Not a number_
81-
95+
8296
```js
83-
let a = 10 / 'dog';
84-
console.log(a)
97+
let a = 10 / "dog";
98+
console.log(a);
8599

86100
// result: NaN
87101
```
88102

89-
<a name="objects"></a>
90-
- ### Objects
103+
<a name="objects"></a>
104+
105+
- ### Objects
106+
91107
Everything in javascript is an object, are use for collections of data or functionality.
92108

93109
```js
@@ -97,32 +113,37 @@ const cool = true;
97113
age = '35'
98114
};
99115
```
116+
100117
order doesn't matter in objects, we can access to the properties, the easiest way is:
101118

102119
```js
103-
person.firstName // access to the first name properti
104-
person.lastName // access to the last name properti
105-
person.age // access to the age properti
120+
person.firstName; // access to the first name properties
121+
person.lastName; // access to the last name properties
122+
person.age; // access to the age properties
106123
```
107124

108-
<a name="null_undefined"></a>
109-
- ### Null and Undefined
125+
<a name="null_undefined"></a>
126+
127+
- ### Null and Undefined
128+
110129
**Undefined:** comes when you try to access toa variable that has been created, but not set.
111130

112131
```js
113132
let dog;
114-
console.log(dog); //result should be undefined
133+
console.log(dog); //result should be undefined
115134
```
116135

117-
**Null:** is a value of nothing
136+
**Null:** is a value of nothing
118137

119138
```js
120-
let somethingNull = null;
139+
let somethingNull = null;
121140
```
122-
<a name="booleans"></a>
123-
- ### Boolians and equiality
124141

125-
**Booleans:** is a value of true or false, can be manually set or calculate:
142+
<a name="booleans"></a>
143+
144+
- ### Booleans and equality
145+
146+
**Booleans:** is a value of true or false, can be manually set or calculate:
126147

127148
```js
128149
//manually set
@@ -134,24 +155,26 @@ const cool = true;
134155
console.log(ofAge); // result should be false
135156
```
136157

137-
**Equality:** we have:
158+
**Equality:** we have:
159+
138160
- = (setting or updating a variable)
139161
- == (it compares the value but not the type of )
140162
- === (compares the value and type of )
141163

142164
```js
143165
// =
144-
let dog = 'Sharon';
166+
let dog = "Sharon";
145167

146168
// ==
147-
"10" == 10 //result is true, it compares the value but not the type of (both values are 10)
169+
"10" == 10; //result is true, it compares the value but not the type of (both values are 10)
148170

149171
// ===
150-
"10" === 10 // result is false, compares value and type of (first one is string, second one is number)
151-
```
172+
"10" === 10; // result is false, compares value and type of (first one is string, second one is number)
173+
```
152174

153175
<br>
154176

155177
---
178+
156179
back to [Table of Content](tableOfContent.md)
157-
next [Functions](02_functions.md)
180+
next [Functions](02_functions.md)

0 commit comments

Comments
 (0)
Please sign in to comment.