From efc5559780bfd0cd4b5479a7dbdabb44c6db976e Mon Sep 17 00:00:00 2001 From: Shakhruh Hasanov Date: Wed, 5 Mar 2025 16:29:26 -0600 Subject: [PATCH 1/2] Lesson 3 --- ...d-implicit-conversion-in-javascript.js => Main.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) rename explicit-and-implicit-conversion-in-javascript.js => Main.js (66%) diff --git a/explicit-and-implicit-conversion-in-javascript.js b/Main.js similarity index 66% rename from explicit-and-implicit-conversion-in-javascript.js rename to Main.js index ede0ccd..0600cb1 100644 --- a/explicit-and-implicit-conversion-in-javascript.js +++ b/Main.js @@ -19,14 +19,18 @@ Use console.log() to clearly show the before-and-after type conversions. */ -let result = "5" - 2; +let result = "5" - 2;//this one example of implicit type conversion console.log("The result is: " + result); -let isValid = Boolean("false"); +let isValid = Boolean("false" === "true");//this also explicit conversion. boolean method onlu converts empty, null,Nan, 0 to false. It does not convert string +//console.log(isValid); if (isValid) { - console.log("This is valid!"); + console.log("This is valid!");//this should not run +} +else{ + console.log("This is not valid!"); } let age = "25"; -let totalAge = age + 5; +let totalAge = Number(age) + 5;//this is explicit type conversion console.log("Total Age: " + totalAge); From c11afe93b0973fc8b97ef8671fa5a7748d00f5c4 Mon Sep 17 00:00:00 2001 From: Maftuna Avazova Date: Wed, 5 Mar 2025 20:31:43 -0600 Subject: [PATCH 2/2] push test again --- Main.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Main.js b/Main.js index 0600cb1..ca823eb 100644 --- a/Main.js +++ b/Main.js @@ -34,3 +34,6 @@ else{ let age = "25"; let totalAge = Number(age) + 5;//this is explicit type conversion console.log("Total Age: " + totalAge); + + +// end \ No newline at end of file