diff --git a/.gitignore b/.gitignore
index 91a80f9..4aa296c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@ playground
/playground
.DS_Store
test.js
+res.md
day3.md
day4.md
day5.md
@@ -13,10 +14,7 @@ day9.md
day10.md
01_02_03_days_backup.md
test.md
-06_Day
-07_Day
-08_Day
-09_Day
10_Day
11_Day
-12_Day
\ No newline at end of file
+12_Day
+test.html
\ No newline at end of file
diff --git a/01_Day/01_day_starter/index.html b/01_Day/01_day_starter/index.html
index ac4827d..43831f6 100644
--- a/01_Day/01_day_starter/index.html
+++ b/01_Day/01_day_starter/index.html
@@ -6,6 +6,8 @@
+
30DaysOfJavaScript:03 Day
+
Introduction
diff --git a/01_Day/Day -1 – 1.png b/01_Day/Day -1 – 1.png
deleted file mode 100644
index dd583c7..0000000
Binary files a/01_Day/Day -1 – 1.png and /dev/null differ
diff --git a/01_Day/varaible.js b/01_Day/varaible.js
new file mode 100644
index 0000000..f5872af
--- /dev/null
+++ b/01_Day/varaible.js
@@ -0,0 +1,17 @@
+// Declaring different variables of different data types
+let firstName = 'Asabeneh' // first name of a person
+let lastName = 'Yetayeh' // last name of a person
+let country = 'Finland' // country
+let city = 'Helsinki' // capital city
+let age = 100 // age in years
+let isMarried = true
+
+// Declaring variables with number values
+const gravity = 9.81 // earth gravity in m/s2
+const boilingPoint = 100 // water boiling point, temperature in oC
+const PI = 3.14 // geometrical constant
+
+// Variables can also be declaring in one line separated by comma
+let name = 'Asabeneh', //name of a person
+ job = 'teacher',
+ live = 'Finland'
diff --git a/02_Day/02_day_data_types.md b/02_Day/02_day_data_types.md
index 17f3f1f..79c2d86 100644
--- a/02_Day/02_day_data_types.md
+++ b/02_Day/02_day_data_types.md
@@ -1,10 +1,24 @@
-
-## Table of Contents
+
[<< Day 1](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/readMe.md) | [Day 3 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/03_Day/03_booleans_operators_date.md)
---
-
+
- [📔 Day 2](#%f0%9f%93%94-day-2)
- [Data types](#data-types)
@@ -27,7 +41,7 @@
- [String to Int](#string-to-int)
- [String to Float](#string-to-float)
- [Float to Int](#float-to-int)
-- [💻 Day 2: Exercises](#%f0%9f%92%bb-day-2-exercises)
+- [💻 Day 2: Exercises](#-day-2-exercises)
# 📔 Day 2
@@ -311,7 +325,7 @@ Asabeneh Yetayeh. I am 250. I live in Finland
#### Long Literal Strings
-A string could be a single character or paragraph or a page. If the string length is too big it does not fit in one line. We can use the backslash character (\) at the end of each line to indicate that the string will continue on the next line.
+A string could be a single character or paragraph or a page. If the string length is too big it does not fit in one line. We can use the backslash character (\\) at the end of each line to indicate that the string will continue on the next line.
**Example:**
```js
@@ -762,7 +776,7 @@ console.log(string.repeat(10)) // lovelovelovelovelovelovelovelovelovelove
**Example:**
```js
-// Different python data types
+// Different javascript data types
// Let's declare different data types
let firstName = 'Asabeneh' // string
@@ -862,7 +876,7 @@ let numInt = parseInt(num)
console.log(numInt) // 9
```
-🌕 You are awesome. You have just completed day 2 challenge and you are two steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
+🌕 You are awesome. You have just completed day 2 challenges and you are two steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
# 💻 Day 2: Exercises
diff --git a/02_Day/02_day_starter/index.html b/02_Day/02_day_starter/index.html
index b34fd01..03ea938 100644
--- a/02_Day/02_day_starter/index.html
+++ b/02_Day/02_day_starter/index.html
@@ -6,6 +6,8 @@
+
30DaysOfJavaScript:02 Day
+
Data types
diff --git a/03_Day/03_booleans_operators_date.md b/03_Day/03_booleans_operators_date.md
index 508cec1..f3ee5fc 100644
--- a/03_Day/03_booleans_operators_date.md
+++ b/03_Day/03_booleans_operators_date.md
@@ -1,9 +1,24 @@
-## Table of Contents
+
[<< Day 2](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/02_Day/02_day_data_types.md) | [Day 4 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/04_Day/04_day_conditionals.md)
---
-
+
- [📔 Day 3](#%f0%9f%93%94-day-3)
- [Booleans](#booleans)
@@ -34,7 +49,7 @@
- [Getting minutes](#getting-minutes)
- [Getting seconds](#getting-seconds)
- [Getting time](#getting-time)
-- [💻 Day 3: Exercises](#%f0%9f%92%bb-day-3-exercises)
+- [💻 Day 3: Exercises](#-day-3-exercises)
- [1. Exercises: Data types Part](#1-exercises-data-types-part)
- [2. Exercises: Arithmetic Operators Part](#2-exercises-arithmetic-operators-part)
- [3. Exercises: Booleans Part](#3-exercises-booleans-part)
@@ -190,7 +205,7 @@ console.log(0 === false) // false, not exactly the same
console.log(1 == true) // true, equivalent
console.log(1 === true) // false, not exactly the same
console.log(undefined == null) // true
-console.log(undefined === null) // true
+console.log(undefined === null) // false
console.log(NaN == NaN) // false, not equal
console.log(NaN === NaN) // false
console.log(typeof NaN) // number
@@ -207,7 +222,7 @@ console.log('python'.length > 'dragon'.length) // false
Try to understand the above comparisons with some logic. Remember without any logic might be difficult.
JavaScript is some how a wired kind of programming language. JavaScript code run and give you a result but unless you are good at it may not be the desired result.
-As rule of thumb, if a value is not true with == it will not be equall with ===. Using === is safer than using ===. The following [link](https://dorey.github.io/JavaScript-Equality-Table/) has an exhaustive list of comparison of data types.
+As rule of thumb, if a value is not true with == it will not be equal with ===. Using === is safer than using ==. The following [link](https://dorey.github.io/JavaScript-Equality-Table/) has an exhaustive list of comparison of data types.
### Logical Operators
@@ -307,17 +322,17 @@ No need for a rain coat.
let number = 5
number > 0
? console.log(`${number} is a positive number`)
- : console.log(`${number} is a number number`)
+ : console.log(`${number} is a negative number`)
number = -5
number > 0
? console.log(`${number} is a positive number`)
- : console.log(`${number} is a number number`)
+ : console.log(`${number} is a negative number`)
```
```sh
5 is a positive number
--5 is a number number
+-5 is a negative number
```
### Operator Precendence
@@ -481,7 +496,7 @@ const minutes = now.getMinutes() // return number (0 -59)
console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
```
-🌕 You have boundless energy. You have just completed day 3 challenge and you are three steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
+🌕 You have boundless energy. You have just completed day 3 challenges and you are three steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
# 💻 Day 3: Exercises
diff --git a/03_Day/03_day_starter/index.html b/03_Day/03_day_starter/index.html
index feb3027..3db517d 100644
--- a/03_Day/03_day_starter/index.html
+++ b/03_Day/03_day_starter/index.html
@@ -6,6 +6,8 @@
+
30DaysOfJavaScript:03 Day
+
Booleans, undefined, null, date object
diff --git a/03_Day/day_1_3.png b/03_Day/day_1_3.png
deleted file mode 100644
index 1268d2c..0000000
Binary files a/03_Day/day_1_3.png and /dev/null differ
diff --git a/04_Day/04_day_conditionals.md b/04_Day/04_day_conditionals.md
index 624505a..98725d5 100644
--- a/04_Day/04_day_conditionals.md
+++ b/04_Day/04_day_conditionals.md
@@ -1,18 +1,33 @@
-## Table of Contents
+
[<< Day 3](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/03_Day/03_booleans_operators_date.md) | [Day 5 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/05_Day/05_day_arrays.md)
---
-
+
- [📔 Day 4](#%f0%9f%93%94-day-4)
- [Conditionals](#conditionals)
- [if](#if)
- [if else](#if-else)
- - [if else if else else](#if-else-if-else-else)
+ - [if else if else](#if-else-if-else)
- [Switch](#switch)
- [Ternary Operators](#ternary-operators)
-- [💻 Exercise : Conditionals](#%f0%9f%92%bb-exercise--conditionals)
+- [💻 Exercise : Conditionals](#-exercise--conditionals)
# 📔 Day 4
@@ -113,7 +128,7 @@ if (isRaining) {
The above condition is false, therefore the else block was executed. How about if our condition is more than two, we will use *else if* conditions.
-### if else if else else
+### if else if else
On our daily life, we make decision on daily basis. We make decision not by checking one or two conditions instead we make decisions based on multiple conditions. As similar to our daily life, programming is also full conditions. We use *else if* when we have multiple conditions.
@@ -193,9 +208,11 @@ switch (weather) {
default:
console.log(' No need for rain coat.')
}
+
// Switch More Examples
-var dayUserInput = prompt('What day is today ?')
-var day = dayUserInput.toLowerCase()
+let dayUserInput = prompt('What day is today ?')
+let day = dayUserInput.toLowerCase()
+
switch (day) {
case 'monday':
console.log('Today is Monday')
@@ -218,10 +235,10 @@ switch (day) {
case 'sunday':
console.log('Today is Sunday')
break
-
default:
console.log('It is not a week day.')
}
+
```
### Ternary Operators
@@ -235,7 +252,7 @@ isRaining
: console.log('No need for a rain coat.')
```
-🌕 You are extraordinary and you have a remarkable potential. You have just completed day 4 challenge and you are four steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
+🌕 You are extraordinary and you have a remarkable potential. You have just completed day 4 challenges and you are four steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
# 💻 Exercise : Conditionals
@@ -289,7 +306,7 @@ isRaining
Enter a number: 2
2 is an even number
- Enter a number 9
+ Enter a number: 9
9 is is an odd number.
```
@@ -328,4 +345,4 @@ isRaining
🎉 CONGRATULATIONS ! 🎉
-[<< Day 3](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/03_Day/03_booleans_operators_date.md) | [Day 5 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/05_Day/05_day_arrays.md)
\ No newline at end of file
+[<< Day 3](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/03_Day/03_booleans_operators_date.md) | [Day 5 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/05_Day/05_day_arrays.md)
diff --git a/04_Day/04_day_starter/04_day_starter/index.html b/04_Day/04_day_starter/04_day_starter/index.html
deleted file mode 100644
index 30d37fc..0000000
--- a/04_Day/04_day_starter/04_day_starter/index.html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- 30DaysOfJavaScript
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/04_Day/04_day_starter/04_day_starter/scripts/main.js b/04_Day/04_day_starter/04_day_starter/scripts/main.js
deleted file mode 100644
index 7762908..0000000
--- a/04_Day/04_day_starter/04_day_starter/scripts/main.js
+++ /dev/null
@@ -1 +0,0 @@
-// this is your main.js script
\ No newline at end of file
diff --git a/04_Day/04_day_starter/index.html b/04_Day/04_day_starter/index.html
index 3936631..30d37fc 100644
--- a/04_Day/04_day_starter/index.html
+++ b/04_Day/04_day_starter/index.html
@@ -2,7 +2,7 @@
- 30DaysOfJavaScript:04 Day
+ 30DaysOfJavaScript
diff --git a/04_Day/04_day_starter/scripts/main.js b/04_Day/04_day_starter/scripts/main.js
index 7762908..ad0c1eb 100644
--- a/04_Day/04_day_starter/scripts/main.js
+++ b/04_Day/04_day_starter/scripts/main.js
@@ -1 +1,3 @@
-// this is your main.js script
\ No newline at end of file
+// this is your main.js script
+
+alert('Open the browser console whenever you work on JavaScript')
\ No newline at end of file
diff --git a/04_Day/day_1_4.png b/04_Day/day_1_4.png
deleted file mode 100644
index d5262c6..0000000
Binary files a/04_Day/day_1_4.png and /dev/null differ
diff --git a/05_Day/05_day_arrays.md b/05_Day/05_day_arrays.md
index e0e327f..d0f52f9 100644
--- a/05_Day/05_day_arrays.md
+++ b/05_Day/05_day_arrays.md
@@ -1,7 +1,23 @@
-## Table of Contents
+
+
+[<< Day 4](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/04_Day/04_day_conditionals.md) | [Day 6 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/06_Day/06_day_loops.md)
-[<< Day 4](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/04_Day/04_day_conditionals.md) | [Day 6 >>](#)
---

- [📔 Day 5](#%f0%9f%93%94-day-5)
@@ -29,19 +45,21 @@
- [Add an element from the beginning](#add-an-element-from-the-beginning)
- [Reversing array order](#reversing-array-order)
- [Sorting elements in array](#sorting-elements-in-array)
+ - [Array of arrays](#array-of-arrays)
- [💻 Exercise](#%f0%9f%92%bb-exercise)
# 📔 Day 5
## Arrays
-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 length of the array.
+In contrast to variables, an 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 length of the array.
-Array is a collection of different data types which are ordered and changeable(modifiable). Allows duplicate element and different data types. An array can be empty or it may have different data type values
+An array is a collection of different data types which are ordered and changeable(modifiable). An array allows storing duplicate elements and different data types. An array can be empty, or it may have different data type values.
### How to create an empty array
-In JavaScript we can create array in different ways. Let us different ways to create an array.
+In JavaScript, we can create an array in different ways. Let us different ways to create an array.
+It is very common to use *const* instead of *let* to declare an array variable. If you ar using const it means you do not use that name again.
- Using Array constructor
@@ -80,19 +98,19 @@ console.log('Numbers:', numbers)
console.log('Number of numbers:', numbers.length)
console.log('Fruits:', fruits)
-console.log('Number of fruits:', len(fruits))
+console.log('Number of fruits:', fruits.length)
console.log('Vegetables:', vegetables)
-console.log('Number of vegetables:', len(vegetables))
+console.log('Number of vegetables:', vegetables.length)
console.log('Animal products:', animalProducts)
-console.log('Number of animal products:', len(animalProducts))
+console.log('Number of animal products:', animalProducts.length)
-console.log('Web technologies:', web_techs)
-console.log('Number of web technologies:', len(webTechs))
+console.log('Web technologies:', webTechs)
+console.log('Number of web technologies:', webTechs.length)
console.log('Countries:', countries)
-console.log('Number of countries:', len(countries))
+console.log('Number of countries:', countries.length)
```
```sh
@@ -114,18 +132,18 @@ Number of countries: 5
```js
const arr = [
- 'Asabeneh',
- 250,
- True,
- { country: 'Finland', city: 'Helsinki' },
- (skills: ['HTML', 'CSS', 'JS', 'React', 'Python'])
+ 'Asabeneh',
+ 250,
+ true,
+ { country: 'Finland', city: 'Helsinki' },
+ { skills: ['HTML', 'CSS', 'JS', 'React', 'Python'] }
] // arr containing different data types
console.log(arr)
```
### Creating an array using split
-As we have seen in earlier section, we can split a string at different position and we can change to an array. Let us see the examples blow.
+As we have seen in the earlier section, we can split a string at different positions, and we can change to an array. Let us see the examples below.
```js
let js = 'JavaScript'
@@ -137,9 +155,9 @@ let companiesString = 'Facebook, Google, Microsoft, Apple, IBM, Oracle, Amazon'
const companies = companiesString.split(',')
console.log(companies) // ["Facebook", " Google", " Microsoft", " Apple", " IBM", " Oracle", " Amazon"]
-let text =
+let txt =
'I love teaching and empowering people. I teach HTML, CSS, JS, React, Python.'
-const words = text.split(' ')
+const words = txt.split(' ')
console.log(words)
// the text has special characters think how you can just get only the words
@@ -148,7 +166,7 @@ console.log(words)
### Accessing array items using index
-We access each element in an array using their index. An array index start from 0. The picture below show clearly the starting of the index.
+We access each element in an array using their index. An array index starts from 0. The picture below clearly shows the starting of the index.

@@ -165,8 +183,9 @@ let lastFruit = fruits[3]
console.log(lastFruit) // lemon
// Last index can be calculated as follows
-let lastIndex = len(fruits) - 1
+let lastIndex = fruits.length - 1
lastFruit = fruits[lastIndex]
+
console.log(lastFruit) // lemon
```
@@ -179,7 +198,7 @@ console.log(numbers[0]) // -> 0
console.log(numbers[5]) // -> 100
let lastIndex = numbers.length - 1;
-console.log(numbers[lastIndex]) -> 100
+console.log(numbers[lastIndex]) // -> 100
```
```js
@@ -199,7 +218,7 @@ console.log(webTechs[0]) // -> HTML
console.log(webTechs[6]) // -> MongoDB
let lastIndex = webTechs.length - 1
-console.log(webTechs[lastIndex]) -> MongoDB
+console.log(webTechs[lastIndex]) // -> MongoDB
```
```js
@@ -222,7 +241,7 @@ console.log(countries[0]) // -> Albania
console.log(countries[10]) // -> Kenya
let lastIndex = countries.length - 1;
-console.log(countries[lastIndex]) -> // Kenya
+console.log(countries[lastIndex]) // -> Kenya
```
```js
@@ -242,12 +261,12 @@ console.log(shoppingCart[0]) // -> Milk
console.log(shoppingCart[7]) // -> Sugar
let lastIndex = shoppingCart.length - 1;
-console.log(shoppingCart[lastIndex]) -> // Sugar
+console.log(shoppingCart[lastIndex]) // -> Sugar
```
### Modifying array element
-An array is mutable(modifiable). Once an array is created we can modify the contents or the array elements.
+An array is mutable(modifiable). Once an array is created, we can modify the contents of the array elements.
```js
const numbers = [1, 2, 3, 4, 5]
@@ -283,7 +302,7 @@ console.log(countries)
### Methods to manipulate 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_
+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_
#### Array Constructor
@@ -305,14 +324,14 @@ fill: Fill all the array elements with a static value
const arr = Array() // creates an an empty array
console.log(arr)
-const eightXvalues = Array(8).fill('X') // it creates eight element values
+const eightXvalues = Array(8).fill('X') // it creates eight element values filled with 'X'
console.log(eightXvalues) // ['X', 'X','X','X','X','X','X','X']
-const eight0values = Array(8).fill(0) // it creates eight element values
-console.log(eight0Values) // [0, 0, 0, 0, 0, 0, 0, 0]
+const eight0values = Array(8).fill(0) // it creates eight element values filled with '0'
+console.log(eight0values) // [0, 0, 0, 0, 0, 0, 0, 0]
-const four4values = Array(4).fill(4) // it creates 4 element values
-console.log(four4Values) // [4, 4, 4, 4, 4, 4, 4, 4]
+const four4values = Array(4).fill(4) // it creates 4 element values filled with '4'
+console.log(four4values) // [4, 4, 4, 4, 4, 4, 4, 4]
```
#### Concatenating array using concat
@@ -328,9 +347,9 @@ console.log(thirdList) // [1, 2, 3, 4, 5, 6]
```
```js
-const fruits = ['banana', 'orange', 'mango', 'lemon'] // array of fruits
+const fruits = ['banana', 'orange', 'mango', 'lemon'] // array of fruits
const vegetables = ['Tomato', 'Potato', 'Cabbage', 'Onion', 'Carrot'] // array of vegetables
-const fruitsAndVegetables = fruits.concat(vegetables)
+const fruitsAndVegetables = fruits.concat(vegetables) // concatenate the two arrays
console.log(fruitsAndVegetables)
```
@@ -345,7 +364,7 @@ Length:To know the size of the array
```js
const numbers = [1, 2, 3, 4, 5]
-console.log(numbers.length) // -> 5
+console.log(numbers.length) // -> 5 is the size of the array
```
#### Getting index an element in arr array
@@ -361,7 +380,7 @@ console.log(numbers.indexOf(1)) // -> 0
console.log(numbers.indexOf(6)) // -> -1
```
-Check an element if it exist in an array
+Check an element if it exist in an array.
- Check items in a list
@@ -382,7 +401,7 @@ if(index != -1){
index != -1 ? console.log('This fruit does exist in the array'): console.log('This fruit does not exist in the array')
// let us check if a avocado exist in the array
-let indexOfAvocado = fruits.indexOf('avocado') // -1
+let indexOfAvocado = fruits.indexOf('avocado') // -1, if the element not found index is -1
if(indexOfAvocado!= -1){
console.log('This fruit does exist in the array')
} else {
@@ -393,12 +412,12 @@ if(indexOfAvocado!= -1){
#### Getting last index of an element in array
-lastIndexOf:Give the position of the last item in the array. If it exist it returns the index else it returns -1.
+lastIndexOf: It gives the position of the last item in the array. If it exist, it returns the index else it returns -1.
```js
const numbers = [1, 2, 3, 4, 5, 3, 1, 2]
-console.log(numbers.lastIndexOf(2)) // -7
+console.log(numbers.lastIndexOf(2)) // 7
console.log(numbers.lastIndexOf(0)) // -1
console.log(numbers.lastIndexOf(1)) // 6
console.log(numbers.lastIndexOf(4)) // 3
@@ -455,7 +474,7 @@ console.log(names.toString()) // Asabeneh,Mathias,Elias,Brook
#### Joining array elements
-join:To join the elements of the array, the argument passed in the join method will be joined in the array and return as a string. By default it joins with a comma but we can pass different string parameter which can be joined between the items.
+join: It used to join the elements of the array, the argument passed in the join method will be joined in the array and return as a string. By default, it joins with a comma, but we can pass different string parameter which can be joined between the items.
```js
const numbers = [1, 2, 3, 4, 5]
@@ -485,33 +504,41 @@ console.log(webTechs.join(' # ')) // "HTML # CSS # JavaScript # React # Redux #
#### Slice array elements
-Slice: To cut out a multiple items in range. It takes two parameters:starting and ending position. It doesn't include the ending position
+Slice: To cut out a multiple items in range. It takes two parameters:starting and ending position. It doesn't include the ending position.
```js
const numbers = [1,2,3,4,5]
- console.log(numbers.slice() // -> it copies all item
- console.log(numbers.slice(0) // -> it copies all item
+ console.log(numbers.slice()) // -> it copies all item
+ console.log(numbers.slice(0)) // -> it copies all item
console.log(numbers.slice(0, numbers.length)) // it copies all item
console.log(numbers.slice(1,4)) // -> [2,3,4] // it doesn't include the ending position
```
#### Splice method in array
-Splice: It takes three parameters:Starting position, number of times to be removed and number items to be added.
+Splice: It takes three parameters:Starting position, number of times to be removed and number of items to be added.
```js
- const numbers = [1, 2, 3, 4, 5];
+ const numbers = [1, 2, 3, 4, 5]
+
+ console.log(numbers.splice()) // -> remove all items
+
+```
- console.log(numbers.splice() // -> remove all items
+```js
+ const numbers = [1, 2, 3, 4, 5]
console.log(numbers.splice(0,1)) // remove the first item
- console.log(numbers.splice(3, 3, 6, 7, 8)) // -> [1,2,6,7,8] //it removes two item and replace three items
+```
+```js
+ const numbers = [1, 2, 3, 4, 5];
+ console.log(numbers.splice(3, 3, 6, 7, 8)) // -> [1, 2, 3, 6, 7, 8] //it removes two item and replace three items
```
#### Adding item to an array using push
-Push: adding item in the end. To add item to the end of an existing array we use the push method
+Push: adding item in the end. To add item to the end of an existing array we use the push method.
```js
// syntax
@@ -544,7 +571,7 @@ console.log(fruits) // ['banana', 'orange', 'mango', 'lemon', 'apple', 'lime']
#### Removing the end element using pop
-Pop: Removing item in the end
+pop: Removing item in the end.
```js
const numbers = [1, 2, 3, 4, 5]
@@ -555,7 +582,7 @@ console.log(numbers) // -> [1,2,3,4]
#### Removing an element from the beginning
-shift: Removing one array element in the beginning of the array
+shift: Removing one array element in the beginning of the array.
```js
const numbers = [1, 2, 3, 4, 5]
@@ -566,18 +593,18 @@ console.log(numbers) // -> [2,3,4,5]
#### Add an element from the beginning
-unshift: Adding array element in the beginning of the array
+unshift: Adding array element in the beginning of the array.
```js
const numbers = [1, 2, 3, 4, 5]
-numbers.unshift(0) // -> remove one item from the beginning
+numbers.unshift(0) // -> add one item from the beginning
console.log(numbers) // -> [0,1,2,3,4,5]
```
#### Reversing array order
-reverse: reverse the order of an array
+reverse: reverse the order of an array.
```js
const numbers = [1, 2, 3, 4, 5]
@@ -591,7 +618,7 @@ console.log(numbers) // [1, 2, 3, 4, 5]
#### Sorting elements in array
-sort: arrange array elements in ascending order. Sort takes a call back function, we wil see how we use sort with call back function in the coming sections.
+sort: arrange array elements in ascending order. Sort takes a call back function, we will see how we use sort with call back function in the coming sections.
```js
const webTechs = [
@@ -611,7 +638,27 @@ webTechs.reverse() // after sorting we can reverse it
console.log(webTechs) // ["Redux", "React", "Node", "MongoDB", "JavaScript", "HTML", "CSS"]
```
-🌕 You are diligent and you have already achieved quite a lot. You have just completed day 5 challenge and you are 5 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
+### Array of arrays
+
+Array can store different data types including an array itself. Let us create an array of arrays
+
+```js
+const firstNums = [1, 2, 3]
+const secondNums = [1, 4, 9]
+
+const arrayOfArray = [[1, 2, 3], [1, 2, 3]]
+console.log(arrayOfArray[0]) // [1, 2, 3]
+
+ const frontEnd = ['HTML', 'CSS', 'JS', 'React', 'Redux']
+ const backEnd = ['Node','Express', 'MongoDB']
+ const fullStack = [frontEnd, backEnd]
+ console.log(fullStack) // [["HTML", "CSS", "JS", "React", "Redux"], ["Node", "Express", "MongoDB"]]
+ console.log(fullStack.length) // 2
+ console.log(fullStack[0]) // ["HTML", "CSS", "JS", "React", "Redux"]
+ console.log(fullStack[1]) // ["Node", "Express", "MongoDB"]
+```
+
+🌕 You are diligent and you have already achieved quite a lot. You have just completed day 5 challenges and you are 5 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
## 💻 Exercise
@@ -690,7 +737,7 @@ const webTechs = [
- Remove 'Honey' if you are allergic to honey
- modify tea to 'Green Tea'
1. In countries array check if 'Ethiopia' exists in the array if it exists print 'ETHIOPIA'. If it does not exist add to the countries list.
-1. In the webTechs array check if Sass exists in the array if it exists print 'Sass is a CSS preprocess'. If it does not exist add Sass to the array.
+1. In the webTechs array check if Sass exists in the array and if it exists print 'Sass is a CSS preprocess'. If it does not exist add Sass to the array and print the array.
1. Concatenate the following two variables and store it in a fullStack variable.
```js
@@ -704,7 +751,7 @@ const webTechs = [
["HTML", "CSS", "JS", "React", "Redux", "Node", "Express", "MongoDB"]
```
-1. The following is a list of 10 students ages:
+1. The following is an array of 10 students ages:
```js
const ages = [19, 22, 19, 24, 20, 25, 26, 24, 25, 24]
@@ -716,9 +763,11 @@ const webTechs = [
- Find the average age(all items divided by number of items)
- Find the range of the ages(max minus min)
- Compare the value of (min - average) and (max - average), use *abs()* method
-1. Find the middle country(ies) in the [countries list](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js)
-1. Divide the countries list into two equal lists if it is even. If countries array is not even one more country for the first half.
+1.Slice the first ten countries from the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js)
+1. Find the middle country(ies) in the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js)
+1. Find the middle country(ies) in the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js)
+1. Divide the countries array into two equal arrays if it is even. If countries array is not even , one more country for the first half.
🎉 CONGRATULATIONS ! 🎉
-[<< Day 4](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/04_Day/04_day_conditionals.md) | [Day 6 >>](#)
\ No newline at end of file
+[<< Day 4](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/04_Day/04_day_conditionals.md) | [Day 6 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/06_Day/06_day_loops.md)
diff --git a/05_Day/05_day_starter/index.html b/05_Day/05_day_starter/index.html
index b7bf583..8f138fb 100644
--- a/05_Day/05_day_starter/index.html
+++ b/05_Day/05_day_starter/index.html
@@ -6,6 +6,8 @@
+
30DaysOfJavaScript:05 Day
+
Arrays
diff --git a/05_Day/05_day_starter/scripts/main.js b/05_Day/05_day_starter/scripts/main.js
index c6045c8..50cc07e 100644
--- a/05_Day/05_day_starter/scripts/main.js
+++ b/05_Day/05_day_starter/scripts/main.js
@@ -1,2 +1,3 @@
console.log(countries)
+alert('Open the browser console whenever you work on JavaScript')
alert('Open the console and check if the countries has been loaded')
\ No newline at end of file
diff --git a/06_Day/06_day_loops.md b/06_Day/06_day_loops.md
new file mode 100644
index 0000000..df16896
--- /dev/null
+++ b/06_Day/06_day_loops.md
@@ -0,0 +1,442 @@
+
+
+[<< Day 5](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/05_Day/05_day_arrays.md) | [Day 7 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/07_Day/07_day_functions.md)
+
+
+
+- [📔 Day 6](#%f0%9f%93%94-day-6)
+ - [Loops](#loops)
+ - [for Loop](#for-loop)
+ - [while loop](#while-loop)
+ - [do while loop](#do-while-loop)
+ - [for of loop](#for-of-loop)
+ - [break](#break)
+ - [continue](#continue)
+ - [💻 Exercises:Day 6](#-exercisesday-6)
+
+# 📔 Day 6
+
+## Loops
+
+Most of the activities we do in life are full of repetitions. Imagine if I ask you to print out from 0 to 100 using console.log(). To implement this simple task it may take you 2 to 5 minutes, such kind of tedious and repetitive task can be carried out using loop.
+
+In programming languages to carry out repetitive task we use different kinds of loop. The following examples are the commonly used loops.
+
+### for Loop
+
+```js
+//For loop structure
+for(initialization, condition, increment/decrement){
+ // code goes here
+}
+```
+
+```js
+for(let i = 0; i <= 5; i++){
+ console.log(i)
+}
+// 0 1 2 3 4 5
+```
+
+```js
+for(let i = 5; i >= 0; i--){
+ console.log(i)
+}
+// 5 4 3 2 1 0
+```
+
+```js
+for(let i = 0; i <= 5; i++){
+ console.log(`${i} * ${i} = ${i * i}`)
+}
+```
+
+```sh
+0 * 0 = 0
+1 * 1 = 1
+2 * 2 = 4
+3 * 3 = 9
+4 * 4 = 16
+5 * 5 = 25
+```
+
+```js
+const countries = ['Finland', 'Sweden', 'Denmark', 'Norway', 'Iceland']
+const newArr = []
+for(let i = 0; i < countries.length; i++){
+ newArr.push(countries[i].toUpperCase())
+}
+//["FINLAND", "SWEDEN", "DENMARK", "NORWAY", "ICELAND"]
+```
+
+Adding all elements in the array
+
+```js
+const numbers = [1, 2, 3, 4, 5]
+let sum = 0
+for(let i = 0; i < numbers.length; i++){
+ sum = sum + numbers[i] // can be shorten, sum += numbers[i]
+
+}
+
+console.log(sum) // 15
+```
+
+Creating a new array based on the existing array
+
+```js
+const numbers = [1, 2, 3, 4, 5]
+const newArr = []
+let sum = 0
+for(let i = 0; i < numbers.length; i++){
+ newArr.push(i * i)
+
+}
+
+console.log(newArr) // [1, 4, 9, 16, 25]
+```
+
+```js
+const countries = ['Finland', 'Sweden', 'Norway', 'Denmark', 'Iceland']
+const newArr = []
+for(let i = 0; i < countries.length; i++){
+ newArr.push(countries[i].toUpperCase())
+}
+
+console.log(newArr) // ["FINLAND", "SWEDEN", "NORWAY", "DENMARK", "ICELAND"]
+```
+
+### while loop
+
+```js
+let i = 0
+while (i <= 5) {
+ console.log(i)
+ i++
+}
+// 0 1 2 3 4 5
+```
+
+### do while loop
+
+```js
+let i = 0
+do {
+ console.log(i)
+ i++
+} while (i <= 5)
+// 0 1 2 3 4 5
+```
+
+### for of loop
+
+We use for of loop for arrays. It is very hand way to iterate through an array if we are not interested in the index.
+
+```js
+for (const element of arr) {
+ // code goes here
+}
+```
+
+```js
+
+const numbers = [1, 2, 3, 4, 5]
+
+for (const num of numbers) {
+ console.log(num) //1 2 3 4 5
+}
+
+for (const num of numbers) {
+ console.log(num * num) //1 4 9 16 25
+}
+
+// adding all the numbers in the array
+let sum = 0
+for (const num of numbers) {
+ sum += sum + num // can be also shorten like this, sum += num
+}
+console.log(sum) // 15
+
+
+
+const webTechs = [
+ 'HTML',
+ 'CSS',
+ 'JavaScript',
+ 'React',
+ 'Redux',
+ 'Node',
+ 'MongoDB'
+]
+
+for (const tech of webTechs) {
+ console.log(tech.toUpperCase()) // HTML CSS JAVASCRIPT REACT NODE MONGODB
+}
+
+for (const tech of webTechs) {
+ console.log(tech[0]) //get only the first letter of each element, H C J R N M
+}
+
+```
+
+```js
+const countries = ['Finland', 'Sweden', 'Norway', 'Denmark', 'Iceland']
+const newArr = []
+for(const country of countries){
+ newArr.push(country.toUpperCase())
+}
+
+console.log(newArr) // ["FINLAND", "SWEDEN", "NORWAY", "DENMARK", "ICELAND"]
+```
+
+### break
+
+content will be added soon
+
+### continue
+
+content will added soon
+
+🌕 You are so brave, you made it to this far. Now, you have gained the power to automate repetitive and tedious tasks. You have just completed day 6 challenges and you are 6 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
+
+## 💻 Exercises:Day 6
+
+ ```js
+ const countries = [
+ 'Albania',
+ 'Bolivia',
+ 'Canada',
+ 'Denmark',
+ 'Ethiopia',
+ 'Finland',
+ 'Germany',
+ 'Hungary',
+ 'Ireland',
+ 'Japan',
+ 'Kenya'
+ ]
+
+ const webTechs = [
+ 'HTML',
+ 'CSS',
+ 'JavaScript',
+ 'React',
+ 'Redux',
+ 'Node',
+ 'MongoDB'
+ ]
+
+ const mernStack = ['MongoDB', 'Express', 'React', 'Node']
+ ```
+
+1. Iterate 0 to 10 using for loop, do the same using while and do while loop
+2. Iterate 10 to 0 using for loop, do the same using while and do while loop
+3. Iterate 0 to n using for loop
+4. Write a loop that makes the following pattern using console.log():
+
+ ```js
+ #
+ ##
+ ###
+ ####
+ #####
+ ######
+ #######
+ ```
+
+5. Use loop to print the following pattern:
+
+ ```sh
+ 0 x 0 = 0
+ 1 x 1 = 1
+ 2 x 2 = 4
+ 3 x 3 = 9
+ 4 x 4 = 16
+ 5 x 5 = 25
+ 6 x 6 = 36
+ 7 x 7 = 49
+ 8 x 8 = 64
+ 9 x 9 = 81
+ 10 x 10 = 100
+ ```
+
+6. Using loop print the following pattern
+
+ ```sh
+ i i^2 i^3
+ 0 0 0
+ 1 1 1
+ 2 4 8
+ 3 9 27
+ 4 16 64
+ 5 25 125
+ 6 36 216
+ 7 49 343
+ 8 64 512
+ 9 81 729
+ 10 100 1000
+ ```
+
+7. Use for loop to iterate from 0 to 100 and print only even numbers
+8. Use for loop to iterate from 0 to 100 and print only odd numbers
+9. Use for loop to iterate from 0 to 100 and print only prime numbers
+10. Use for loop to iterate from 0 to 100 and print and print the sum of all numbers.
+
+ ```sh
+ The sum all numbers is 5050.
+ ```
+
+11. Use for loop to iterate from 0 to 100 and print the sum of all evens and the sum of all odds.
+
+ ```sh
+ The sum of all evens is 2550. And the sum of all odds is 2500.
+ ```
+
+12. Use for loop to iterate from 0 to 100 and print the sum of all evens and the sum of all odds. Print sum of evens and sum of odds as array
+
+ ```sh
+ [2550, 2500]
+ ```
+
+13. Develop a small script which generate array of 5 random numbers
+14. Develop a small script which generate array of 5 random numbers and the numbers must be unique
+15. Develop a small script which generate a six characters random id:
+
+ ```sh
+ 5j2khz
+ ```
+
+16. Develop a small script which generate any number of characters random id:
+
+ ```sh
+ fe3jo1gl124g
+ ```
+
+ ```sh
+ xkqci4utda1lmbelpkm03rba
+ ```
+
+17. Write a script which generates a random hexadecimal number.
+
+ ```sh
+ '#ee33df'
+ ```
+
+18. Write a script which generates a random rgb color number.
+
+ ```sh
+ rgb(240,180,80)
+ ```
+
+19. Using the above countries array, create the following new array.
+
+ ```sh
+ ["ALBANIA", "BOLIVIA", "CANADA", "DENMARK", "ETHIOPIA", "FINLAND", "GERMANY", "HUNGARY", "IRELAND", "JAPAN", "KENYA"]
+ ```
+
+20. Using the above countries array, create an array for countries length'.
+
+ ```sh
+ [7, 7, 6, 7, 8, 7, 7, 7, 7, 5, 5]
+ ```
+
+21. Use the countries array to create the following array of arrays:
+
+ ```sh
+ [
+ ['Albania', 'ALB', 7],
+ ['Bolivia', 'BOL', 7],
+ ['Canada', 'CAN', 6],
+ ['Denmark', 'DEN', 7],
+ ['Ethiopia', 'ETH', 8],
+ ['Finland', 'FIN', 7],
+ ['Germany', 'GER', 7],
+ ['Hungary', 'HUN', 7],
+ ['Ireland', 'IRE', 7],
+ ['Japan', 'JAP', 5],
+ ['Kenya', 'KEN', 5]
+ ]
+ ```
+
+22. In above countries array, check if there is a country or countries containing the word 'land'. If there are countries containing 'land', print it as array. If there is no country containing the word 'land', print 'These are countries without land'.
+
+ ```sh
+ ['Finland', 'Iceland']
+ ```
+
+23. In above countries array, check if there a country or countries end with a substring 'ia'. If there are countries end with, print it as array. If there is no country containing the word 'land', print 'These are countries ends without ia'.
+
+ ```sh
+ ['Albania', 'Bolivia','Ethiopia']
+ ```
+
+24. Using the above countries array, find the country containing the biggest number of characters.
+
+ ```sh
+ Ethiopia
+ ```
+
+25. Using the above countries array, find the country containing only 5 characters.
+
+ ```sh
+ ['Japan', 'Kenya']
+ ```
+
+26. Find the longest word in the webTechs array
+27. Use the webTechs are to create the following array of arrays:
+
+ ```sh
+ [["HTML", 4], ["CSS", 3],["JavaScript", 10],["React", 5],["Redux", 5],["Node", 4],["MongoDB", 7]]
+ ```
+
+28. An application created using MongoDB, Express, React and Node is called a MERN stack. Create the acronym MERN by using the array mernStack
+
+29. Iterate through the array, ["HTML", "CSS", "JS", "React", "Redux", "Node", "Express", "MongoDB"] using a for loop or for of loop and print out the items.
+30. This is a fruit array , ['banana', 'orange', 'mango', 'lemon'] reverse the order using loop without using a reverse method.
+31. Print all the elements of array as shown below.
+
+ ```js
+ const fullStack = [
+ ['HTML', 'CSS', 'JS', 'React'],
+ ['Node', 'Express', 'MongoDB']
+ ]
+ ````
+
+ ```sh
+ HTML
+ CSS
+ JS
+ REACT
+ NODE
+ EXPRESS
+ MONGODB
+ ```
+32. Copy countries array(Avoid mutation)
+33. Arrays are mutable. Create a copy of array which does not modify the original. Sort the copied array and store in a variable sortedCountries
+34. Sort the webTechs array and mernStack array
+35. Extract all the countries contain the word 'land' from the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js) and print it as array
+36. Find the country containing the hightest number of characters in the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js)
+37. Extract all the countries contain the word 'land' from the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js) and print it as array
+38. Extract all the countries containing only four characters from the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js) and print it as array
+39. Extract all the countries containing two or more words from the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js) and print it as array
+40. Reverse the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js) and capitalize each country and stored it as an array
+
+🎉 CONGRATULATIONS ! 🎉
+
+[<< Day 5](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/05_Day/05_day_arrays.md) | [Day 7 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/07_Day/07_day_functions.md)
diff --git a/06_Day/06_day_starter/data/countries.js b/06_Day/06_day_starter/data/countries.js
new file mode 100644
index 0000000..e57b005
--- /dev/null
+++ b/06_Day/06_day_starter/data/countries.js
@@ -0,0 +1,195 @@
+const countries = [
+ 'Afghanistan',
+ 'Albania',
+ 'Algeria',
+ 'Andorra',
+ 'Angola',
+ 'Antigua and Barbuda',
+ 'Argentina',
+ 'Armenia',
+ 'Australia',
+ 'Austria',
+ 'Azerbaijan',
+ 'Bahamas',
+ 'Bahrain',
+ 'Bangladesh',
+ 'Barbados',
+ 'Belarus',
+ 'Belgium',
+ 'Belize',
+ 'Benin',
+ 'Bhutan',
+ 'Bolivia',
+ 'Bosnia and Herzegovina',
+ 'Botswana',
+ 'Brazil',
+ 'Brunei',
+ 'Bulgaria',
+ 'Burkina Faso',
+ 'Burundi',
+ 'Cambodia',
+ 'Cameroon',
+ 'Canada',
+ 'Cape Verde',
+ 'Central African Republic',
+ 'Chad',
+ 'Chile',
+ 'China',
+ 'Colombi',
+ 'Comoros',
+ 'Congo (Brazzaville)',
+ 'Congo',
+ 'Costa Rica',
+ "Cote d'Ivoire",
+ 'Croatia',
+ 'Cuba',
+ 'Cyprus',
+ 'Czech Republic',
+ 'Denmark',
+ 'Djibouti',
+ 'Dominica',
+ 'Dominican Republic',
+ 'East Timor (Timor Timur)',
+ 'Ecuador',
+ 'Egypt',
+ 'El Salvador',
+ 'Equatorial Guinea',
+ 'Eritrea',
+ 'Estonia',
+ 'Ethiopia',
+ 'Fiji',
+ 'Finland',
+ 'France',
+ 'Gabon',
+ 'Gambia, The',
+ 'Georgia',
+ 'Germany',
+ 'Ghana',
+ 'Greece',
+ 'Grenada',
+ 'Guatemala',
+ 'Guinea',
+ 'Guinea-Bissau',
+ 'Guyana',
+ 'Haiti',
+ 'Honduras',
+ 'Hungary',
+ 'Iceland',
+ 'India',
+ 'Indonesia',
+ 'Iran',
+ 'Iraq',
+ 'Ireland',
+ 'Israel',
+ 'Italy',
+ 'Jamaica',
+ 'Japan',
+ 'Jordan',
+ 'Kazakhstan',
+ 'Kenya',
+ 'Kiribati',
+ 'Korea, North',
+ 'Korea, South',
+ 'Kuwait',
+ 'Kyrgyzstan',
+ 'Laos',
+ 'Latvia',
+ 'Lebanon',
+ 'Lesotho',
+ 'Liberia',
+ 'Libya',
+ 'Liechtenstein',
+ 'Lithuania',
+ 'Luxembourg',
+ 'Macedonia',
+ 'Madagascar',
+ 'Malawi',
+ 'Malaysia',
+ 'Maldives',
+ 'Mali',
+ 'Malta',
+ 'Marshall Islands',
+ 'Mauritania',
+ 'Mauritius',
+ 'Mexico',
+ 'Micronesia',
+ 'Moldova',
+ 'Monaco',
+ 'Mongolia',
+ 'Morocco',
+ 'Mozambique',
+ 'Myanmar',
+ 'Namibia',
+ 'Nauru',
+ 'Nepal',
+ 'Netherlands',
+ 'New Zealand',
+ 'Nicaragua',
+ 'Niger',
+ 'Nigeria',
+ 'Norway',
+ 'Oman',
+ 'Pakistan',
+ 'Palau',
+ 'Panama',
+ 'Papua New Guinea',
+ 'Paraguay',
+ 'Peru',
+ 'Philippines',
+ 'Poland',
+ 'Portugal',
+ 'Qatar',
+ 'Romania',
+ 'Russia',
+ 'Rwanda',
+ 'Saint Kitts and Nevis',
+ 'Saint Lucia',
+ 'Saint Vincent',
+ 'Samoa',
+ 'San Marino',
+ 'Sao Tome and Principe',
+ 'Saudi Arabia',
+ 'Senegal',
+ 'Serbia and Montenegro',
+ 'Seychelles',
+ 'Sierra Leone',
+ 'Singapore',
+ 'Slovakia',
+ 'Slovenia',
+ 'Solomon Islands',
+ 'Somalia',
+ 'South Africa',
+ 'Spain',
+ 'Sri Lanka',
+ 'Sudan',
+ 'Suriname',
+ 'Swaziland',
+ 'Sweden',
+ 'Switzerland',
+ 'Syria',
+ 'Taiwan',
+ 'Tajikistan',
+ 'Tanzania',
+ 'Thailand',
+ 'Togo',
+ 'Tonga',
+ 'Trinidad and Tobago',
+ 'Tunisia',
+ 'Turkey',
+ 'Turkmenistan',
+ 'Tuvalu',
+ 'Uganda',
+ 'Ukraine',
+ 'United Arab Emirates',
+ 'United Kingdom',
+ 'United States',
+ 'Uruguay',
+ 'Uzbekistan',
+ 'Vanuatu',
+ 'Vatican City',
+ 'Venezuela',
+ 'Vietnam',
+ 'Yemen',
+ 'Zambia',
+ 'Zimbabwe'
+]
diff --git a/06_Day/06_day_starter/index.html b/06_Day/06_day_starter/index.html
new file mode 100644
index 0000000..28d2d78
--- /dev/null
+++ b/06_Day/06_day_starter/index.html
@@ -0,0 +1,17 @@
+
+
+
+
+ 30DaysOfJavaScript:06 Day
+
+
+
+
30DaysOfJavaScript:06 Day
+
Loops
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/06_Day/06_day_starter/scripts/main.js b/06_Day/06_day_starter/scripts/main.js
new file mode 100644
index 0000000..c6045c8
--- /dev/null
+++ b/06_Day/06_day_starter/scripts/main.js
@@ -0,0 +1,2 @@
+console.log(countries)
+alert('Open the console and check if the countries has been loaded')
\ No newline at end of file
diff --git a/07_Day/07_day_functions.md b/07_Day/07_day_functions.md
new file mode 100644
index 0000000..1bf1e1c
--- /dev/null
+++ b/07_Day/07_day_functions.md
@@ -0,0 +1,683 @@
+
+
+[<< Day 6](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/06_Day/06_day_loops.md) | [Day 8 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/08_Day/08_day_objects.md)
+
+
+
+- [📔 Day 7](#%f0%9f%93%94-day-7)
+ - [Functions](#functions)
+ - [Function Declaration](#function-declaration)
+ - [Function without a parameter and return](#function-without-a-parameter-and-return)
+ - [Function returning value](#function-returning-value)
+ - [Function with a parameter](#function-with-a-parameter)
+ - [Function with two parameters](#function-with-two-parameters)
+ - [Function with many parameters](#function-with-many-parameters)
+ - [Function with unlimited number of parameters](#function-with-unlimited-number-of-parameters)
+ - [Unlimited number of parameters in regular function](#unlimited-number-of-parameters-in-regular-function)
+ - [Unlimited number of parameters in arrow function](#unlimited-number-of-parameters-in-arrow-function)
+ - [Anonymous Function](#anonymous-function)
+ - [Expression Function](#expression-function)
+ - [Self Invoking Functions](#self-invoking-functions)
+ - [Arrow Function](#arrow-function)
+ - [Function with default parameters](#function-with-default-parameters)
+ - [Function declaration versus Arrow function](#function-declaration-versus-arrow-function)
+ - [💻 Exercises](#-exercises)
+
+# 📔 Day 7
+
+## Functions
+
+So far we have seen many builtin JavaScript functions. In this section, we will focus on custom functions. What is a function? Before we start making functions, lets understand what function is and why we need function?
+
+A function is a reusable block of code or programming statements designed to perform a certain task.
+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 parameter. To store a data to a function, a function has to return certain data types. To get the value we call or invoke a function.
+Function makes code:
+
+- clean and easy to read
+- reusable
+- easy to test
+
+A function can be declared or created in couple of ways:
+
+- _Declaration function_
+- _Expression function_
+- _Anonymous function_
+- _Arrow function_
+
+### Function Declaration
+
+Let us see how to declare a function and how to call a function.
+
+```js
+//declaring a function without a parameter
+function functionName() {
+ // code goes here
+}
+functionName() // calling function by its name and with parentheses
+```
+
+### Function without a parameter and return
+
+Function can be declared without a parameter.
+
+**Example:**
+
+```js
+// function without parameter, a function which square a number
+function square() {
+ let num = 2
+ let sq = num * num
+ console.log(sq)
+}
+square() // 4
+
+// function without parameter
+function addTwoNumbers() {
+ let numOne = 10
+ let numTwo = 20
+ let sum = numOne + numTwo
+
+ console.log(sum)
+}
+addTwoNumbers() // function has to be called to be executed by it name
+```
+
+```js
+ function generateFullName (){
+ let firstName = 'Asabeneh'
+ let lastName = 'Yetayeh'
+ let space = ' '
+ let fullName = firstName + space + lastName
+ console.log(fullName)
+}
+ generateFullName() // calling a function
+```
+
+### Function returning value
+
+Function can also return values, if a function does not return values the value of the function is undefined. Let us write the above functions with return. From now on, we return value to a function instead of printing it.
+
+```js
+function generateFullName (){
+ let firstName = 'Asabeneh'
+ let lastName = 'Yetayeh'
+ let space = ' '
+ let fullName = firstName + space + lastName
+ return fullName
+}
+console.log(generateFullName())
+```
+
+```js
+
+ function addTwoNumbers() {
+ let numOne = 2
+ let numTwo = 3
+ let total = numOne + numTwo
+ return total
+
+ }
+
+console.log(addTwoNumbers())
+```
+
+### Function with a parameter
+
+In a function we can pass different data types(number, string, boolean, object, function) as a parameter.
+
+```js
+// function with one parameter
+function functionName(parm1) {
+ //code goes her
+}
+functionName(parm1) // during calling or invoking one argument needed
+
+function areaOfCircle(r) {
+ let area = Math.PI * r * r
+ return area
+}
+
+console.log(areaOfCircle(10)) // should be called with one argument
+
+function square(number) {
+ return number * number
+}
+
+console.log(square(10))
+```
+
+### Function with two parameters
+
+```js
+// function with two parameters
+function functionName(parm1, parm2) {
+ //code goes her
+}
+functionName(parm1, parm2) // during calling or invoking two arguments needed
+// Function without parameter doesn't take input, so lets make a parameter with parameter
+function sumTwoNumbers(numOne, numTwo) {
+ let sum = numOne + numTwo
+ console.log(sum)
+}
+sumTwoNumbers(10, 20) // calling functions
+// If a function doesn't return it doesn't store data, so it should return
+function sumTwoNumbersAndReturn(numOne, numTwo) {
+ let sum = numOne + numTwo
+ return sum
+}
+
+console.log(sumTwoNumbersAndReturn(10, 20))
+function printFullName(firstName, lastName) {
+ return `${firstName} ${lastName}`
+}
+console.log(printFullName('Asabeneh', 'Yetayeh'))
+```
+
+### Function with many parameters
+
+```js
+// function with multiple parameters
+function functionName(parm1, parm2, parm3,...){
+ //code goes here
+}
+functionName(parm1,parm2,parm3,...) // during calling or invoking three arguments needed
+
+
+// this function takes array as a parameter and sum up the numbers in the array
+function sumArrayValues(arr) {
+ let sum = 0;
+ for (let i = 0; i < arr.length; i++) {
+ sum = sum + numbers[i];
+ }
+ return sum;
+}
+const numbers = [1, 2, 3, 4, 5];
+ //calling a function
+console.log(sumArrayValues(numbers));
+
+
+ const areaOfCircle = (radius) => {
+ let area = Math.PI * radius * radius;
+ return area;
+ }
+console.log(areaOfCircle(10))
+
+```
+
+### Function with unlimited number of parameters
+
+Sometimes we do not know how many arguments the user going to pass. Therefore, we should know how to write a function which can take unlimited number of arguments. The way we do it has a significant difference between a function declaration(regular function) and arrow function.Let us see examples both in function declaration and arrow function.
+
+#### Unlimited number of parameters in regular function
+
+ A function declaration provides a function scoped arguments array like object. Any thing we passed as argument in the function can be accessed from arguments object inside the functions. Let us see an example
+
+ ```js
+// Let us access the arguments object
+
+function sumAllNums() {
+ console.log(arguments)
+}
+
+sumAllNums(1, 2, 3, 4))
+// Arguments(4) [1, 2, 3, 4, callee: ƒ, Symbol(Symbol.iterator): ƒ]
+
+```
+
+```js
+// function declaration
+
+function sumAllNums() {
+ let sum = 0
+ for (let i = 0; i < arguments.length; i++) {
+ sum += arguments[i]
+ }
+ return sum
+}
+
+console.log(sumAllNums(1, 2, 3, 4)) // 10
+console.log(sumAllNums(10, 20, 13, 40, 10)) // 93
+console.log(sumAllNums(15, 20, 30, 25, 10, 33, 40)) // 173
+```
+
+#### Unlimited number of parameters in arrow function
+
+ Arrow function does not have the function scoped arguments object. To implement a function which takes unlimited number of arguments in an arrow function we use spread operator followed by any parameter name. Any thing we passed as argument in the function can be accessed as array in the arrow function. Let us see an example
+
+ ```js
+// Let us access the arguments object
+
+const sumAllNums = (...args) => {
+ // console.log(arguments), arguments object not found in arrow function
+ // instead we use an a parameter followed by spread operator
+ console.log(args)
+}
+
+sumAllNums(1, 2, 3, 4))
+// [1, 2, 3, 4]
+
+```
+
+```js
+// function declaration
+
+const sumAllNums = (...args) => {
+ let sum = 0
+ for (const element of args) {
+ sum += element
+ }
+ return sum
+}
+
+console.log(sumAllNums(1, 2, 3, 4)) // 10
+console.log(sumAllNums(10, 20, 13, 40, 10)) // 93
+console.log(sumAllNums(15, 20, 30, 25, 10, 33, 40)) // 173
+```
+
+### Anonymous Function
+
+Anonymous function or without name
+
+```js
+const anonymousFun = function() {
+ console.log(
+ 'I am an anonymous function and my value is stored in anonymousFun'
+ )
+}
+```
+
+### Expression Function
+
+Expression functions are anonymous functions. After we create a function without a name and with assign it to a variable. To return a value from the function we should call the variable. Look at the example below.
+
+```js
+//Declaration function
+function square(n) {
+ return n * n
+}
+
+console.log(square(2)) // -> 4
+
+// Function expression
+const square = function(n) {
+ return n * n
+}
+
+console.log(square(2)) // -> 4
+```
+
+### Self Invoking Functions
+
+Self invoking functions are anonymous functions which do not need to be called to return a value.
+
+```js
+(function(n) {
+ console.log(n * n)
+})(2) // 4, but instead of just printing if we want to return and store the data, we do as shown below
+
+let squaredNum = (function(n) {
+ return n * n
+})(10)
+
+console.log(squaredNum)
+```
+
+### Arrow Function
+
+Arrow function is an alternative to write a function, however function declaration and arrow function have some minor differences.
+
+Arrow function uses arrow instead of the keyword function to declare a function. Let us see both function declaration and arrow function.
+
+```js
+// This is how we write normal or declaration function
+// Let us change this declaration function to an arrow function
+function square(n) {
+ return n * n
+}
+
+console.log(square(2)) // 4
+
+const square = n => {
+ return n * n
+}
+
+console.log(square(2)) // -> 4
+// if we have only one line, it can be written as follows, explicit return
+const square = n => n * n // -> 4
+```
+
+```js
+const changeToUpperCase = arr => {
+ const newArr = []
+ for (const element of arr) {
+ newArr.push(element.toUpperCase())
+ }
+ return newArr
+}
+
+const countries = ['Finland', 'Sweden', 'Norway', 'Denmark', 'Iceland']
+console.log(changeToUpperCase(countries))
+
+// ["FINLAND", "SWEDEN", "NORWAY", "DENMARK", "ICELAND"]
+```
+
+```js
+const printFullName = (firstName, lastName) => {
+ return `${firstName} ${lastName}`
+}
+
+console.log(printFullName('Asabeneh', 'Yetayeh'))
+```
+
+The above function has only the return statement, therefore, we can explicitly return it as follows.
+
+```js
+const printFullName = (firstName, lastName) => `${firstName} ${lastName}`
+
+console.log(printFullName('Asabeneh', 'Yetayeh'))
+```
+
+### Function with default parameters
+
+Sometimes we pass default values to parameters, when we invoke the function if we do not pass an argument the default value will be used. Both function declaration and arrow function can have a default value or values.
+
+```js
+// syntax
+// Declaring a function
+function functionName(param = value) {
+ //codes
+}
+
+// Calling function
+functionName()
+functionName(arg)
+```
+
+**Example:**
+
+```js
+function greetings(name = 'Peter') {
+ let message = `${name}, welcome to 30 Days Of JavaScript!`
+ return message
+}
+
+console.log(greetings())
+console.log(greetings('Asabeneh'))
+```
+
+```js
+function generateFullName(firstName = 'Asabeneh', lastName = 'Yetayeh') {
+ let space = ' '
+ let fullName = firstName + space + lastName
+ return fullName
+}
+
+console.log(generateFullName())
+console.log(generateFullName('David', 'Smith'))
+```
+
+```js
+function calculateAge(birthYear, currentYear = 2019) {
+ let age = currentYear - birthYear
+ return age
+}
+
+console.log('Age: ', calculateAge(1819))
+```
+
+```js
+function weightOfObject(mass, gravity = 9.81) {
+ let weight = mass * gravity + ' N' // the value has to be changed to string first
+ return weight
+}
+
+console.log('Weight of an object in Newton: ', weightOfObject(100)) // 9.81 gravity at the surface of Earth
+console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gravity at surface of Moon
+```
+
+Let us see how we write the above functions with arrow functions
+
+```js
+// syntax
+// Declaring a function
+const functionName = (param = value) => {
+ //codes
+}
+
+// Calling function
+functionName()
+functionName(arg)
+```
+
+**Example:**
+
+```js
+const greetings = (name = 'Peter') => {
+ let message = name + ', welcome to 30 Days Of JavaScript!'
+ return message
+}
+
+console.log(greetings())
+console.log(greetings('Asabeneh'))
+```
+
+```js
+const generateFullName = (firstName = 'Asabeneh', lastName = 'Yetayeh') => {
+ let space = ' '
+ let fullName = firstName + space + lastName
+ return fullName
+}
+
+console.log(generateFullName())
+console.log(generateFullName('David', 'Smith'))
+```
+
+```js
+
+const calculateAge = (birthYear, currentYear = 2019) => currentYear - birthYear
+console.log('Age: ', calculateAge(1819))
+```
+
+```js
+const weightOfObject = (mass, gravity = 9.81) => mass * gravity + ' N'
+
+console.log('Weight of an object in Newton: ', weightOfObject(100)) // 9.81 gravity at the surface of Earth
+console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gravity at surface of Moon
+```
+
+### Function declaration versus Arrow function
+
+🌕 You are a rising star, now you knew function . Now, you are super charged with the power of functions. You have just completed day 7 challenges and you are 7 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
+
+## 💻 Exercises
+
+1. Declare a function _fullName_ and it print out your full name.
+2. Declare a function _fullName_ and now it takes firstName, lastName as a parameter and it returns your full - name.
+3. Declare a function _addNumbers_ and it takes two two parameters and it returns sum.
+4. An area of a rectangle is calculated as follows: _area = length x width_. Write a function which calculates _areaOfRectangle_.
+5. A perimeter of a rectangle is calculated as follows: _perimeter= 2x(length + width)_. Write a function which calculates _perimeterOfRectangle_.
+6. A volume of a rectangular prism is calculated as follows: _volume = length x width x height_. Write a function which calculates _volumeOfRectPrism_.
+7. Area of a circle is calculated as follows: _area = π x r x r_. Write a function which calculates _areaOfCircle_
+8. Circumference of a circle is calculated as follows: _circumference = 2πr_. Write a function which calculates _circumOfCircle_
+9. Density of a substance is calculated as follows:_density= mass/volume_. Write a function which calculates _density_.
+10. Speed is calculated by dividing the total distance covered by a moving object divided by the total amount of time taken. Write a function which calculates a speed of a moving object, _speed_.
+11. Weight of a substance is calculated as follows: _weight = mass x gravity_. Write a function which calculates _weight_.
+12. Temperature in oC can be converted to oF using this formula: _oF = (oC x 9/5) + 32_. Write a function which convert oC to oF _convertCelciusToFahrenheit_.
+13. Body mass index(BMI) is calculated as follows: _bmi = weight in Kg / (height x height) in m2_. Write a function which calculates _bmi_. BMI is used to broadly define different weight groups in adults 20 years old or older.Check if a person is _underweight, normal, overweight_ or _obese_ based the information given below.
+
+ - The same groups apply to both men and women.
+ - _Underweight_: BMI is less than 18.5
+ - _Normal weight_: BMI is 18.5 to 24.9
+ - _Overweight_: BMI is 25 to 29.9
+ - _Obese_: BMI is 30 or more
+
+14. Write a function called _checkSeason_, it takes a month parameter and returns the season:Autumn, Winter, Spring or Summer.
+15. Math.max returns its largest argument. Write a function findMax that takes three arguments and returns their maximum with out using Math.max method.
+
+ ```js
+ console.log(findMax(0, 10, 5))
+ 10
+ console.log(findMax(0, -10, -2))
+ 0
+ ```
+
+16. Linear equation is calculated as follows: _ax + by + c = 0_. Write a function which calculates value of a linear equation, _solveLinEquation_.
+17. Quadratic equation is calculated as follows: _ax2 + bx + c = 0_. Write a function which calculates value or values of a quadratic equation, _solveQuadEquation_.
+
+ ```js
+ console.log(solveQuadratic()) // {0}
+ console.log(solveQuadratic(1, 4, 4)) // {-2}
+ console.log(solveQuadratic(1, -1, -2)) // {2, -1}
+ console.log(solveQuadratic(1, 7, 12)) // {-3, -4}
+ console.log(solveQuadratic(1, 0, -4)) //{2, -2}
+ console.log(solveQuadratic(1, -1, 0)) //{1, 0}
+ ```
+
+18. Declare a function name _printArray_. It takes array as a parameter and it prints out each value of the array.
+19. 11. Write a function name _showDateTime_ which shows time in this format: 08/01/2020 04:08 using the Date object.
+
+ ```sh
+ showDateTime()
+ 08/01/2020 04:08
+ ```
+
+20. Declare a function name _swapValues_. This function swaps value of x to y.
+
+ ```js
+ swapValues(3, 4) // x => 4, y=>3
+ swapValues(4, 5) // x = 5, y = 4
+ ```
+
+21. Declare a function name _reverseArray_. It takes array as a parameter and it returns the reverse of the array (don't use method).
+
+ ```js
+ console.log(reverseArray([1, 2, 3, 4, 5]))
+ //[5, 4, 3, 2, 1]
+ console.log(reverseArray(['A', 'B', 'C']))
+ //['C', 'B', 'A']
+ ```
+
+22. Declare a function name _capitalizeArray_. It takes array as a parameter and it returns the - capitalizedarray.
+23. Declare a function name _addItem_. It takes an item parameter and it returns an array after adding the item
+24. Declare a function name _removeItem_. It takes an index parameter and it returns an array after removing an item
+25. Declare a function name _sumOfNumbers_. It takes a number parameter and it adds all the numbers in that range.
+26. Declare a function name _sumOfOdds_. It takes a number parameter and it adds all the odd numbers in that - range.
+27. Declare a function name _sumOfEven_. It takes a number parameter and it adds all the even numbers in that - range.
+28. Declare a function name evensAndOdds . It takes a positive integer as parameter and it counts number of evens and odds in the number.
+
+ ```sh
+ evensAndOdds(100);
+ The number of odds are 50.
+ The number of evens are 51.
+ ```
+
+29. Write a function which takes any number of arguments and return the sum of the arguments
+
+ ```js
+ sum(1, 2, 3) // -> 6
+ sum(1, 2, 3, 4) // -> 10
+ ```
+
+30. Writ a function which generates a _randomUserIp_.
+31. Write a function which generates a _randomMacAddress_
+32. Declare a function name _randomHexaNumberGenerator_. When this function is called it generates a random hexadecimal number. The function return the hexadecimal number.
+
+ ```sh
+ console.log(randomHexaNumberGenerator());
+ '#ee33df'
+ ```
+
+33. Declare a function name _userIdGenerator_. When this function is called it generates seven character id. The function return the id.
+
+ ```sh
+ console.log(userIdGenerator());
+ 41XTDbE
+ ```
+
+34. Modify question number n . Declare a function name _userIdGeneratedByUser_. It doesn’t take any parameter but it takes two inputs using prompt(). One of the input is the number of characters and the second input is the number of ids which are supposed to be generated.
+
+ ```sh
+ userIdGeneratedByUser()
+ 'kcsy2
+ SMFYb
+ bWmeq
+ ZXOYh
+ 2Rgxf
+ '
+ userIdGeneratedByUser()
+ '1GCSgPLMaBAVQZ26
+ YD7eFwNQKNs7qXaT
+ ycArC5yrRupyG00S
+ UbGxOFI7UXSWAyKN
+ dIV0SSUTgAdKwStr
+ '
+ ```
+
+35. Write a function name _rgbColorGenerator_ and it generates rgb colors.
+
+ ```sh
+ rgbColorGenerator()
+ rgb(125,244,255)
+ ```
+
+36. Write a function **_arrayOfHexaColors_** which return any number of hexadecimal colors in an array.
+37. Write a function **_arrayOfRgbColors_** which return any number of RGB colors in an array.
+38. Write a function **_convertHexaToRgb_** which converts hexa color to rgb and it returns an rgb color.
+39. Write a function **_convertRgbToHexa_** which converts rgb to hexa color and it returns an hexa color.
+40. Write a function **_generateColors_** which can generate any number of hexa or rgb colors.
+
+ ```js
+ console.log(generateColors('hexa', 3)) // ['#a3e12f', '#03ed55', '#eb3d2b']
+ console.log(generateColors('hexa', 1)) // '#b334ef'
+ console.log(generateColors('rgb', 3)) // ['rgb(5, 55, 175)', 'rgb(50, 105, 100)', 'rgb(15, 26, 80)']
+ console.log(generateColors('rgb', 1)) // 'rgb(33,79, 176)'
+ ```
+
+41. Call your function _shuffleArray_, it takes an array as a parameter and it returns a shuffled array
+42. Call your function _factorial_, it takes a whole number as a parameter and it return a factorial of the number
+43. Call your function _isEmpty_, it takes a parameter and it checks if it is empty or not
+44. Call your function _sum_, it takes any number of arguments and it returns the sum.
+45. Write a function called _sumOfArrayItems_, it takes an array parameter and return the sum of all the items. Check if all the array items are number types. If not give return reasonable feedback.
+46. Write a function called _average_, it takes an array parameter and returns the average of the items. Check if all the array items are number types. If not give return reasonable feedback.
+47. Write a function called _modifyArray_ takes array as parameter and modifies the fifth item of the array and return the array. If the array length is less than five it return 'item not found'.
+
+ ```js
+ console.log(modifyArray(['Avocado', 'Tomato', 'Potato','Mango', 'Lemon','Carrot']);
+ // →['Avocado', 'Tomato', 'Potato','Mango', 'LEMON', 'Carrot']
+ console.log(modifyArray(['Google', 'Facebook','Apple', 'Amazon','Microsoft', 'IBM']);
+ // →['Google', 'Facebook','Apple', 'Amazon','MICROSOFT', 'IBM']
+ console.log(modifyArray(['Google', 'Facebook','Apple', 'Amazon']);
+ // →'Not Found'
+ ```
+
+48. Write a function called _isPrime_, which checks if a number is prime number.
+49. Write a functions which checks if all items are unique in the array.
+50. Write a function which checks if all the items of the array are the same data type.
+51. JavaScript variable name does not support special characters or symbols except \$ or \_. Write a function **\*isValidVariable** which check if a variable is valid or invalid variable.
+52. Write a function which returns array of seven random numbers in a range of 0-9. All the numbers must be unique.
+
+ ```js
+ sevenRandomNumbers()[(1, 4, 5, 7, 9, 8, 0)]
+ ```
+
+53. Write a function called reverseCountries, it takes countries array and first it copy the array and returns the reverse of the original array
+
+🎉 CONGRATULATIONS ! 🎉
+
+[<< Day 6](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/06_Day/06_day_loops.md) | [Day 8 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/08_Day/08_day_objects.md)
diff --git a/07_Day/07_day_starter/data/countries.js b/07_Day/07_day_starter/data/countries.js
new file mode 100644
index 0000000..e57b005
--- /dev/null
+++ b/07_Day/07_day_starter/data/countries.js
@@ -0,0 +1,195 @@
+const countries = [
+ 'Afghanistan',
+ 'Albania',
+ 'Algeria',
+ 'Andorra',
+ 'Angola',
+ 'Antigua and Barbuda',
+ 'Argentina',
+ 'Armenia',
+ 'Australia',
+ 'Austria',
+ 'Azerbaijan',
+ 'Bahamas',
+ 'Bahrain',
+ 'Bangladesh',
+ 'Barbados',
+ 'Belarus',
+ 'Belgium',
+ 'Belize',
+ 'Benin',
+ 'Bhutan',
+ 'Bolivia',
+ 'Bosnia and Herzegovina',
+ 'Botswana',
+ 'Brazil',
+ 'Brunei',
+ 'Bulgaria',
+ 'Burkina Faso',
+ 'Burundi',
+ 'Cambodia',
+ 'Cameroon',
+ 'Canada',
+ 'Cape Verde',
+ 'Central African Republic',
+ 'Chad',
+ 'Chile',
+ 'China',
+ 'Colombi',
+ 'Comoros',
+ 'Congo (Brazzaville)',
+ 'Congo',
+ 'Costa Rica',
+ "Cote d'Ivoire",
+ 'Croatia',
+ 'Cuba',
+ 'Cyprus',
+ 'Czech Republic',
+ 'Denmark',
+ 'Djibouti',
+ 'Dominica',
+ 'Dominican Republic',
+ 'East Timor (Timor Timur)',
+ 'Ecuador',
+ 'Egypt',
+ 'El Salvador',
+ 'Equatorial Guinea',
+ 'Eritrea',
+ 'Estonia',
+ 'Ethiopia',
+ 'Fiji',
+ 'Finland',
+ 'France',
+ 'Gabon',
+ 'Gambia, The',
+ 'Georgia',
+ 'Germany',
+ 'Ghana',
+ 'Greece',
+ 'Grenada',
+ 'Guatemala',
+ 'Guinea',
+ 'Guinea-Bissau',
+ 'Guyana',
+ 'Haiti',
+ 'Honduras',
+ 'Hungary',
+ 'Iceland',
+ 'India',
+ 'Indonesia',
+ 'Iran',
+ 'Iraq',
+ 'Ireland',
+ 'Israel',
+ 'Italy',
+ 'Jamaica',
+ 'Japan',
+ 'Jordan',
+ 'Kazakhstan',
+ 'Kenya',
+ 'Kiribati',
+ 'Korea, North',
+ 'Korea, South',
+ 'Kuwait',
+ 'Kyrgyzstan',
+ 'Laos',
+ 'Latvia',
+ 'Lebanon',
+ 'Lesotho',
+ 'Liberia',
+ 'Libya',
+ 'Liechtenstein',
+ 'Lithuania',
+ 'Luxembourg',
+ 'Macedonia',
+ 'Madagascar',
+ 'Malawi',
+ 'Malaysia',
+ 'Maldives',
+ 'Mali',
+ 'Malta',
+ 'Marshall Islands',
+ 'Mauritania',
+ 'Mauritius',
+ 'Mexico',
+ 'Micronesia',
+ 'Moldova',
+ 'Monaco',
+ 'Mongolia',
+ 'Morocco',
+ 'Mozambique',
+ 'Myanmar',
+ 'Namibia',
+ 'Nauru',
+ 'Nepal',
+ 'Netherlands',
+ 'New Zealand',
+ 'Nicaragua',
+ 'Niger',
+ 'Nigeria',
+ 'Norway',
+ 'Oman',
+ 'Pakistan',
+ 'Palau',
+ 'Panama',
+ 'Papua New Guinea',
+ 'Paraguay',
+ 'Peru',
+ 'Philippines',
+ 'Poland',
+ 'Portugal',
+ 'Qatar',
+ 'Romania',
+ 'Russia',
+ 'Rwanda',
+ 'Saint Kitts and Nevis',
+ 'Saint Lucia',
+ 'Saint Vincent',
+ 'Samoa',
+ 'San Marino',
+ 'Sao Tome and Principe',
+ 'Saudi Arabia',
+ 'Senegal',
+ 'Serbia and Montenegro',
+ 'Seychelles',
+ 'Sierra Leone',
+ 'Singapore',
+ 'Slovakia',
+ 'Slovenia',
+ 'Solomon Islands',
+ 'Somalia',
+ 'South Africa',
+ 'Spain',
+ 'Sri Lanka',
+ 'Sudan',
+ 'Suriname',
+ 'Swaziland',
+ 'Sweden',
+ 'Switzerland',
+ 'Syria',
+ 'Taiwan',
+ 'Tajikistan',
+ 'Tanzania',
+ 'Thailand',
+ 'Togo',
+ 'Tonga',
+ 'Trinidad and Tobago',
+ 'Tunisia',
+ 'Turkey',
+ 'Turkmenistan',
+ 'Tuvalu',
+ 'Uganda',
+ 'Ukraine',
+ 'United Arab Emirates',
+ 'United Kingdom',
+ 'United States',
+ 'Uruguay',
+ 'Uzbekistan',
+ 'Vanuatu',
+ 'Vatican City',
+ 'Venezuela',
+ 'Vietnam',
+ 'Yemen',
+ 'Zambia',
+ 'Zimbabwe'
+]
diff --git a/07_Day/07_day_starter/index.html b/07_Day/07_day_starter/index.html
new file mode 100644
index 0000000..f7eb67c
--- /dev/null
+++ b/07_Day/07_day_starter/index.html
@@ -0,0 +1,17 @@
+
+
+
+
+ 30DaysOfJavaScript:07 Day
+
+
+
+
30DaysOfJavaScript:07 Day
+
Functions
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/07_Day/07_day_starter/scripts/main.js b/07_Day/07_day_starter/scripts/main.js
new file mode 100644
index 0000000..c6045c8
--- /dev/null
+++ b/07_Day/07_day_starter/scripts/main.js
@@ -0,0 +1,2 @@
+console.log(countries)
+alert('Open the console and check if the countries has been loaded')
\ No newline at end of file
diff --git a/08_Day/08_day_objects.md b/08_Day/08_day_objects.md
new file mode 100644
index 0000000..8995dec
--- /dev/null
+++ b/08_Day/08_day_objects.md
@@ -0,0 +1,497 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/08_Day/08_day_starter/scripts/main.js b/08_Day/08_day_starter/scripts/main.js
new file mode 100644
index 0000000..c6045c8
--- /dev/null
+++ b/08_Day/08_day_starter/scripts/main.js
@@ -0,0 +1,2 @@
+console.log(countries)
+alert('Open the console and check if the countries has been loaded')
\ No newline at end of file
diff --git a/09_Day/09_day_higher_order_functions.md b/09_Day/09_day_higher_order_functions.md
new file mode 100644
index 0000000..58af802
--- /dev/null
+++ b/09_Day/09_day_higher_order_functions.md
@@ -0,0 +1,585 @@
+
[Day 2 >>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/02_Day/02_day_data_types.md)
---

@@ -36,7 +51,7 @@
- [Checking Data types](#checking-data-types)
- [Comments](#comments)
- [Variables](#variables)
-- [💻 Day 1: Exercises](#%f0%9f%92%bb-day-1-exercises)
+- [💻 Day 1: Exercises](#-day-1-exercises)
# 📔Day 1
@@ -227,10 +242,15 @@ If you installed visual studio code, let us start using it.
Open the visual studio code by double-clicking the visual studio icon. When you open it, you will get this kind of interface. Try to interact with the labeled icons.

+

+

+

+

+

## Adding JavaScript to a web page
@@ -298,6 +318,7 @@ This is how we write the internal script most of the time. Writing the JavaScrip
```
Open the browser console to see the output from the console.log()
+

### External script
@@ -320,7 +341,7 @@ External scripts in the head
-
```
External scripts in the body
@@ -336,7 +357,7 @@ External scripts in the body
// Here is the recommended place to put the external script
-