From 9971832825a57141780f932e26cf590e93408599 Mon Sep 17 00:00:00 2001 From: mmehdiali5 Date: Sat, 27 Jan 2024 22:08:48 -0500 Subject: [PATCH 1/8] Name in Readme done --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a3a32bc..9a8fcf9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ # learn-js JavaScript tutorial repo -### REPLACE WITH YOUR FULL NAME +### MUHAMMAD MEHDI ALI From eab38bd47b63986251a89da5b3b4d6402430b745 Mon Sep 17 00:00:00 2001 From: mmehdiali5 Date: Sat, 27 Jan 2024 22:26:46 -0500 Subject: [PATCH 2/8] where2put.js consol error script should be in body --- quiz/where2putjs.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/quiz/where2putjs.html b/quiz/where2putjs.html index 0dff0b6..e4c59ca 100644 --- a/quiz/where2putjs.html +++ b/quiz/where2putjs.html @@ -4,12 +4,7 @@ Title - +
@@ -17,6 +12,11 @@

Demo JavaScript in Body

Placeholder ...

- + \ No newline at end of file From 86c8e99cec23c22c9fba31eaff0dd252c3e8f4bd Mon Sep 17 00:00:00 2001 From: mmehdiali5 Date: Sat, 27 Jan 2024 23:00:10 -0500 Subject: [PATCH 3/8] vars1.html --- quiz/vars1.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quiz/vars1.html b/quiz/vars1.html index 3e4b023..134ae09 100644 --- a/quiz/vars1.html +++ b/quiz/vars1.html @@ -3,11 +3,11 @@ diff --git a/quiz/vars3.html b/quiz/vars3.html index 5b2d10d..1bf2253 100644 --- a/quiz/vars3.html +++ b/quiz/vars3.html @@ -5,8 +5,8 @@ const PI = 3.14159; { let radius = 5; - let area = PI * radius * radius; - PI = 3.0; + var area = PI * radius * radius; + //PI = 3.0; } console.log(area); From 1763b644f608cb235e88e785c69360488ba89897 Mon Sep 17 00:00:00 2001 From: mmehdiali5 Date: Sun, 28 Jan 2024 23:27:04 -0500 Subject: [PATCH 5/8] logger --- quiz/scripts/logger.js | 19 +++++++++++++++++++ scripts/whatisthis.js | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/quiz/scripts/logger.js b/quiz/scripts/logger.js index 5d03eb6..603f2f7 100644 --- a/quiz/scripts/logger.js +++ b/quiz/scripts/logger.js @@ -1 +1,20 @@ // Define a JavaScript function called logMsg() that can be used to log an error message for any object that contains the property errMsg. +function logMsg() { + if (this && this.errMsg) { + console.error(this.errMsg); + } else { + console.log("No error message found."); + } +} + + +const objectWithErrorMessage = { + errMsg: "This is an error message." +}; + +const objectWithoutErrorMessage = { + someData: "No error message here." +}; + +logMsg.call(objectWithErrorMessage); // Logs the error message +logMsg.call(objectWithoutErrorMessage); \ No newline at end of file diff --git a/scripts/whatisthis.js b/scripts/whatisthis.js index 8cba7b1..df2fa01 100644 --- a/scripts/whatisthis.js +++ b/scripts/whatisthis.js @@ -9,4 +9,5 @@ const person = { } } -console.log(person.fullName()); \ No newline at end of file +console.log(person.fullName()); +console.log(window.lastName); \ No newline at end of file From 60943c418c098d9ffbc676b62254b1d3ac1d1f05 Mon Sep 17 00:00:00 2001 From: mmehdiali5 Date: Sun, 28 Jan 2024 23:56:33 -0500 Subject: [PATCH 6/8] closure.html done --- quiz/arrow.html | 2 +- quiz/scripts/closure.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/quiz/arrow.html b/quiz/arrow.html index d877db1..98ab01e 100644 --- a/quiz/arrow.html +++ b/quiz/arrow.html @@ -12,7 +12,7 @@