From 5a95f04fb0adf3cfc8b7b0752969db4938e882f0 Mon Sep 17 00:00:00 2001 From: Asabeneh Date: Mon, 6 Jan 2020 15:40:02 +0200 Subject: [PATCH] restructuring --- 01_Day/01_day_starter/index.html | 2 + 02_Day/02_day_starter/index.html | 2 + 03_Day/03_day_starter/index.html | 2 + .../04_day_starter/04_day_starter/index.html | 15 ------ .../04_day_starter/scripts/main.js | 1 - 04_Day/04_day_starter/index.html | 2 +- 04_Day/04_day_starter/scripts/main.js | 4 +- 05_Day/05_day_starter/index.html | 2 + 05_Day/05_day_starter/scripts/main.js | 1 + readMe.md | 51 +++++++++++-------- 10 files changed, 44 insertions(+), 38 deletions(-) delete mode 100644 04_Day/04_day_starter/04_day_starter/index.html delete mode 100644 04_Day/04_day_starter/04_day_starter/scripts/main.js diff --git a/01_Day/01_day_starter/index.html b/01_Day/01_day_starter/index.html index ac4827dc..43831f6d 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/02_Day/02_day_starter/index.html b/02_Day/02_day_starter/index.html index b34fd010..03ea938e 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_day_starter/index.html b/03_Day/03_day_starter/index.html index feb3027b..3db517d8 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/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 30d37fcf..00000000 --- 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 77629084..00000000 --- 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 39366314..30d37fcf 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 77629084..ad0c1eb7 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/05_Day/05_day_starter/index.html b/05_Day/05_day_starter/index.html index b7bf5836..8f138fbd 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 c6045c83..50cc07ea 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/readMe.md b/readMe.md index a55b1176..b15d8e1d 100644 --- a/readMe.md +++ b/readMe.md @@ -227,10 +227,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. ![Vscode ui](./images/vscode_ui.png) + ![Vscode add project](./images/adding_project_to_vscode.png) + ![Vscode open project](./images/opening_project_on_vscode.png) + ![script file](images/scripts_on_vscode.png) + ![running script](./images/running_script.png) + ![coding running](./images/launched_on_new_tab.png) ## Adding JavaScript to a web page @@ -298,6 +303,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() + ![js code from vscode](./images/js_code_vscode.png) ### External script @@ -320,7 +326,7 @@ External scripts in the head - ``` External scripts in the body @@ -336,7 +342,7 @@ External scripts in the body // Here is the recommended place to put the external script - ``` Open the browser console to see the output from the console.log() @@ -361,10 +367,11 @@ console.log('Hello, World!') - ``` Your main.js file should be below all other scripts. Watch out your exercise needs to understand this line. + ![Multiple Script](./images/multiple_script.png) ## Introduction to Data types @@ -403,8 +410,8 @@ A boolean data type is either a True or False value. **Example:** ```js - true # if the light on ,the value is true - false # if the light off, the value is False + true // if the light on ,the value is true + false // if the light off, the value is False ``` ### Undefined @@ -431,8 +438,8 @@ To check the data type of a certain data type, we use the **typeof** operator. S ```js console.log(typeof 'Asabeneh') // string console.log(typeof 5) // number -console.log(typeof true ) // boolean -console.log(typeof null) // object type +console.log(typeof true ) // boolean +console.log(typeof null) // object type console.log(typeof undefined) // undefined ``` @@ -445,6 +452,7 @@ There are two ways of commenting: - _Multiline commenting_ ```js +// commenting the code itself with a single comment // let firstName = 'Asabeneh'; single line comment // let lastName = 'Yetayeh'; single line comment ``` @@ -466,10 +474,10 @@ Variables are _containers_ of data. Variables used to _store_ data in a memory l For a variable that changes at a different time, we use _let_. If the data does not change at all, we use _const_. For example, PI, country name, gravity do no change, and we can use *const*. -* A JavaScript variable name should not begin with a number. -* A JavaScript variable name does not allow special characters except dollar sign and underscore. -* A JavaScript variable name follows a camelCase convention. -* A JavaScript variable name should not have space between words. +- A JavaScript variable name should not begin with a number. +- A JavaScript variable name does not allow special characters except dollar sign and underscore. +- A JavaScript variable name follows a camelCase convention. +- A JavaScript variable name should not have space between words. The following are valid examples of JavaScript variables. Valid variables in JavaScript: @@ -516,21 +524,24 @@ Let us declare variables with different data types. To declare a variable, we ne ```js // 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 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 + console.log(firstName, lastName, country, city, age, isMarried); //Asabeneh, Yetayeh, Finland, Helsinki, 100, 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 +const gravity = 9.81 // earth gravity in m/s2 +const boilingPoint = 100 // water boiling point, temperature in oC +const PI = 3.14 // geometrical constant + console.log(gravity, boilingPoint, PI); // 9.81, 100, 3.14 // Variables can also be declaring in one line separated by comma -let name = 'Asabeneh', //name of a person +let name = 'Asabeneh', // name of a person job = 'teacher', live = 'Finland'; console.log(name, job, live);