From 4dbd70aca4cf8a1dca015a6d3d4fef2c5001876e Mon Sep 17 00:00:00 2001 From: matt vile Date: Wed, 14 Apr 2021 15:13:57 +0100 Subject: [PATCH] complete Day 1 of JS --- .../01_day_starter/datatypes.js | 16 ++++++++++++++++ 01_Day_Introduction/01_day_starter/index.html | 5 +++-- .../01_day_starter/introduction.js | 9 ++++++++- 01_Day_Introduction/01_day_starter/varaible.js | 18 +++++++++++------- 4 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 01_Day_Introduction/01_day_starter/datatypes.js diff --git a/01_Day_Introduction/01_day_starter/datatypes.js b/01_Day_Introduction/01_day_starter/datatypes.js new file mode 100644 index 0000000..1572678 --- /dev/null +++ b/01_Day_Introduction/01_day_starter/datatypes.js @@ -0,0 +1,16 @@ +let firstName = 'Matthew' +let yourName = "ODB" +let yourAge = 100 +let myAge = 21 +const PI = 3.14 +let isMarried = true +let nullValue = null +let notDefined +let anotherOne +let andAnotherOne +let undefinedVarFour +array = [firstName, myAge, PI, isMarried, nullValue, notDefined] +array.forEach(logType) +function logType(variable){console.log(typeof variable)} +console.log(`${firstName} is ${myAge} years old`) +console.log(`${yourName} is ${yourAge} years old, what an oldie!`) diff --git a/01_Day_Introduction/01_day_starter/index.html b/01_Day_Introduction/01_day_starter/index.html index 43831f6..31f817b 100644 --- a/01_Day_Introduction/01_day_starter/index.html +++ b/01_Day_Introduction/01_day_starter/index.html @@ -11,9 +11,10 @@ - + + - \ No newline at end of file + diff --git a/01_Day_Introduction/01_day_starter/introduction.js b/01_Day_Introduction/01_day_starter/introduction.js index 316199c..77d136e 100644 --- a/01_Day_Introduction/01_day_starter/introduction.js +++ b/01_Day_Introduction/01_day_starter/introduction.js @@ -1 +1,8 @@ -console.log('Welcome to 30DaysOfJavaScript') \ No newline at end of file +// comments can make code readable +console.log('Welcome to 30DaysOfJavaScript') +// display Welcome to 30DaysOfJavaScript +/* comments can make code readable + easy to reuse + and informative + this is a multiline comment +*/ diff --git a/01_Day_Introduction/01_day_starter/varaible.js b/01_Day_Introduction/01_day_starter/varaible.js index 62558cb..bc6a257 100644 --- a/01_Day_Introduction/01_day_starter/varaible.js +++ b/01_Day_Introduction/01_day_starter/varaible.js @@ -1,11 +1,13 @@ // 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 +const variablesList = () => { +let firstName = 'Asabeneh' // first name of a person string +let lastName = 'Yetayeh' // last name of a person string +let country = 'Finland' // country string +let city = 'Helsinki' // capital city string +let age = 100 // age in years number +let isMarried = true // boolean value +let nullValue = null // null value +let notDefined // returns not defined // Declaring variables with number values @@ -18,3 +20,5 @@ const PI = 3.14 // geometrical constant let name = 'Asabeneh', //name of a person job = 'teacher', live = 'Finland' +} +export { variablesList };