From 905b08a2e33ab7fe252c2192c4f07f0d0e46cd81 Mon Sep 17 00:00:00 2001 From: Mujeeb ur Rahman <mujeeburahman4582@gmail.com> Date: Sun, 5 Feb 2023 13:04:11 +0500 Subject: [PATCH] Add the solution --- .../01_day_starter/day1_solution/comments.js | 7 +++++ .../01_day_starter/day1_solution/datatypes.js | 5 +++ .../01_day_starter/day1_solution/variable.js | 28 +++++++++++++++++ 01_Day_Introduction/01_day_starter/index.html | 31 +++++++++---------- 01_Day_Introduction/01_day_starter/main.js | 7 +++-- .../01_day_starter/variable.js | 28 ++++++++++------- 6 files changed, 75 insertions(+), 31 deletions(-) create mode 100644 01_Day_Introduction/01_day_starter/day1_solution/comments.js create mode 100644 01_Day_Introduction/01_day_starter/day1_solution/datatypes.js create mode 100644 01_Day_Introduction/01_day_starter/day1_solution/variable.js diff --git a/01_Day_Introduction/01_day_starter/day1_solution/comments.js b/01_Day_Introduction/01_day_starter/day1_solution/comments.js new file mode 100644 index 0000000..51bb85f --- /dev/null +++ b/01_Day_Introduction/01_day_starter/day1_solution/comments.js @@ -0,0 +1,7 @@ +// comments can make code readable +// Welcome to 30DaysOfJavaScript + +/* + comments can make code readable, + easy to reuse and informative +*/ diff --git a/01_Day_Introduction/01_day_starter/day1_solution/datatypes.js b/01_Day_Introduction/01_day_starter/day1_solution/datatypes.js new file mode 100644 index 0000000..c4ba970 --- /dev/null +++ b/01_Day_Introduction/01_day_starter/day1_solution/datatypes.js @@ -0,0 +1,5 @@ +console.log(typeof studentName); +console.log(typeof learning); +console.log(typeof age); +console.log(typeof score); +console.log(typeof grade); diff --git a/01_Day_Introduction/01_day_starter/day1_solution/variable.js b/01_Day_Introduction/01_day_starter/day1_solution/variable.js new file mode 100644 index 0000000..c68db1c --- /dev/null +++ b/01_Day_Introduction/01_day_starter/day1_solution/variable.js @@ -0,0 +1,28 @@ +// Create a variable.js file and declare variables and assign string, boolean, undefined and null data types + +let newStudentName = "Mujeeb ur Rahman"; +let learning = true; +let newAge = 25; +let score; +let grad = null; + +let firstVariable; +let secondVariable; +let thirdVariable; +let fourthVariable; + +let fifthVariable = "fifthVariable"; +let sixthVariable = 6; +let seventhVariable = true; +let eighthVariable = 8.0; + +let myFirstName = "Mujeeb ur", + myLastName = "Rahman", + materialStatus = "single", + myCountry = "Pakistan", + myAge = 30; + +let yourAge = 25; + +console.log(`I am ${myAge} years old`); +console.log(`You are ${yourAge} years old`); diff --git a/01_Day_Introduction/01_day_starter/index.html b/01_Day_Introduction/01_day_starter/index.html index 7ed5b19..71ce6ec 100644 --- a/01_Day_Introduction/01_day_starter/index.html +++ b/01_Day_Introduction/01_day_starter/index.html @@ -1,19 +1,18 @@ <!DOCTYPE html> <html lang="en"> + <head> + <title>30DaysOfJavaScript</title> + </head> -<head> - <title>30DaysOfJavaScript</title> -</head> - -<body> - <h1>30DaysOfJavaScript:03 Day</h1> - <h2>Introduction</h2> - <button onclick="alert('Welcome to 30DaysOfJavaScript!');">Click Me</button> - <script src="./helloworld.js"></script> - <script src="./introduction.js"></script> - <script src="./variable.js"></script> - <script src="./main.js"></script> - -</body> - -</html> \ No newline at end of file + <body> + <h1>30DaysOfJavaScript:03 Day</h1> + <h2>Introduction</h2> + <button onclick="alert('Welcome to 30DaysOfJavaScript!');">Click Me</button> + <script src="./helloworld.js"></script> + <script src="./introduction.js"></script> + <script src="./variable.js"></script> + <script src="./main.js"></script> + <script src="./day1_solution/variable.js"></script> + <script src="./day1_solution/datatypes.js"></script> + </body> +</html> diff --git a/01_Day_Introduction/01_day_starter/main.js b/01_Day_Introduction/01_day_starter/main.js index 2b952bc..c49eeb9 100644 --- a/01_Day_Introduction/01_day_starter/main.js +++ b/01_Day_Introduction/01_day_starter/main.js @@ -1,4 +1,5 @@ // the variable values can be accessed from other variable.js file -console.log(firstName, lastName, country, city, age, isMarried) -console.log(gravity, boilingPoint, PI) // 9.81, 100, 3.14 -console.log(name, job, live) \ No newline at end of file +console.log(firstName, lastName, country, city, age, isMarried); +console.log(gravity, boilingPoint, PI); // 9.81, 100, 3.14 +console.log(name, job, live); +console.log(studentName, studentJob, studentLive); diff --git a/01_Day_Introduction/01_day_starter/variable.js b/01_Day_Introduction/01_day_starter/variable.js index 62558cb..d2d7a51 100644 --- a/01_Day_Introduction/01_day_starter/variable.js +++ b/01_Day_Introduction/01_day_starter/variable.js @@ -1,20 +1,24 @@ // 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 +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 +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' +let name = "Asabeneh", //name of a person + job = "teacher", + live = "Finland"; + +let studentName = "Mujeeb ur Rahman", + studentJob = "software learner", + studentLive = "Pakistan";