You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**_JavaScript for Everone_** is a guide for both beginner and advanced JavaScript developers. Welcome to JavaScript. **_Congratulations_** for deciding to learn JavaScript.
34
34
35
35
In this step by step tutorial, you will learn JavaScript, the most popular programming language in the history of mankind.
@@ -38,12 +38,12 @@ You use JavaScript **_to add interactivity to websites, to develop mobile apps,
38
38
programming language for four consecutive years and is the most used programming language on
39
39
Github.
40
40
41
-
##Setup
41
+
# Setup
42
42
43
43
First thing first, lets install text or code editor. Install code editor, it could be [vscode](https://code.visualstudio.com/), [atom](https://atom.io/), [bracket](http://brackets.io/), [notepad++](https://notepad-plus-plus.org/) or others. I recommend vscode.
44
44
Install either [Chrome](https://www.google.com/chrome/) or [Firefox](https://www.mozilla.org/en-US/firefox/new/?v=b) if you didn't have yet.
45
45
46
-
If you want help, you may join the [telegram](https://web.telegram.org/#/im?p=g393844817) channel.
46
+
If you want help, you may join the [telegram](https://t.me/JavaScriptforEveryone) channel.
47
47
48
48
## Adding JavaScript to a web page
49
49
JavaScript can be added to a web pages in three ways:
@@ -101,7 +101,7 @@ Internal script can be written in the _head_ or the _body_ but it is preferrable
101
101
102
102
####Exercises:SettingUpyourmachine
103
103
104
-
##Variables
104
+
#Variables
105
105
Variablesare_containers_ofdata.Variables_store_datainamemorylocation.Whenavariableisdeclaredamemorylocationisreservedandwhenitisassignedtoavalue,thememoryspacewillbefilled.Todeclareavariableweuse,_var_,_let_or_const_keyword.Foravariablewhichchangesatdifferenttimeweuse_let_butifthedatadoesn't change at all we use _const_. For example PI, country name, gravity.
106
106
107
107
Valid variables in JavaScript:
@@ -127,25 +127,23 @@ Valid variables in JavaScript:
127
127
year_2019
128
128
```
129
129
130
-
Camel case or the first way of declaring is conventional in JavaScript.
130
+
Camel case or the first way of declaring is conventional in JavaScript. In this material, camelCase variables will be used.
131
131
132
132
Invalid variable:
133
133
```js
134
134
first-name
135
135
1_num
136
136
num_#_1
137
137
```
138
-
139
-
140
138
```js
141
139
// Declaring different variables of different data types
142
140
let firstName = "Asabeneh"; // first name of a person
143
141
let lastName = "Yetayeh"; // last name of a person
@@ -493,7 +491,7 @@ Which are true or which are false ?
493
491
1. 4 == '4'
494
492
1. 4 === '4'
495
493
496
-
##Conditionals
494
+
# Conditionals
497
495
498
496
#### If
499
497
@@ -638,11 +636,11 @@ isRaining
638
636
- March, April or May, the season is Spring
639
637
- June, July or August, the season is Summer
640
638
641
-
##Loops
639
+
# Loops
642
640
643
641
In programming languages to carry out repetitive task we use different kinds of loop. The following examples are the commonly used loops.
644
642
645
-
###For Loop
643
+
## For Loop
646
644
647
645
```js
648
646
//For loop structure
@@ -655,7 +653,7 @@ for(let i = 0; i <= 5; i++){
655
653
656
654
```
657
655
658
-
###While loop
656
+
## While loop
659
657
660
658
```js
661
659
let i =0;
@@ -665,7 +663,7 @@ while (i <= 5) {
665
663
}
666
664
```
667
665
668
-
###Do while loop
666
+
## Do while loop
669
667
670
668
```js
671
669
let i =0;
@@ -701,7 +699,7 @@ do {
701
699
The sum of all evens is 2550. And the sum of all odds is 2500.
702
700
```
703
701
704
-
##Arrays
702
+
# Arrays
705
703
706
704
In contrast to variables array can store _multiple values_. Each value in an array has an _index_ and each index has _a reference in a memory address_. Each value can be accessed by using their _indexes_. The index of an array starts from _zero_ and the last element is less by one from the lenght of the array.
There are different methods to manipulate an array. These are some of the available methods to deal with arrays:_Array,length, concat, indexOf, slice, splice, join, toString, includes, lastIndexOf, isArray, fill, push, pop, shift, unshift_
797
795
Array:To create an array.
@@ -971,7 +969,7 @@ const todoList = [
971
969
972
970
```
973
971
974
-
## Functions
972
+
# Functions
975
973
976
974
A function is a block of code designed to perform a certain task.
977
975
A function is declared by a function key word followed by a name, followed by parentheses (). A parentheses can take a parameter. If a function take a parameter it will be called with argument. A function can also take a default paramenter.
@@ -1240,7 +1238,7 @@ const square = n => n * n; // -> 4
1240
1238
```
1241
1239
1242
1240
1243
-
## Object
1241
+
# Object
1244
1242
1245
1243
Everything can be an object and objects do have properties and properties have values.
1246
1244
@@ -1840,7 +1838,7 @@ Asabeneh Yetayeh lives in Finland. He is 200 years old. He is an Instructor and
1840
1838
2. Assign the elements of countries array to fin, est, sw, den, nor
1841
1839
3. Destructure the rectangle object by its propertis or keys.
1842
1840
1843
-
## Document Object Model
1841
+
# Document Object Model (DOM)
1844
1842
HTML document is structured as a JavaScript Object. Every HTML element has a different properties which can help to manipulate it. It is possible to get, create, append or remove HTML elements using JavaScript. Check the examples below. Selecting HTML element using JavaScript is similar to select CSS. To select an HTML element, we use tag name, id, class name. To create an HTML element we use tag name.
0 commit comments