From 093443f55db53b1f9c635204d043b83337d44132 Mon Sep 17 00:00:00 2001 From: Sahil Rajesh Shriwardhankar <102847495+notsointresting@users.noreply.github.com> Date: Sun, 22 Dec 2024 13:41:37 +0000 Subject: [PATCH 1/3] Completed first iteration --- js/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/js/index.js b/js/index.js index 59e4af7..c5e8fe9 100644 --- a/js/index.js +++ b/js/index.js @@ -1,4 +1,9 @@ // Iteration 1: Names and Input +let hacker1 = 'Joe' +console.log("The driver's name is "+hacker1); + +let hacker2 = 'John' +console.log("The navigator's name is "+hacker2); // // Iteration 2: Conditionals From f2a1aad28530598aa4546851f6ff81cb782de958 Mon Sep 17 00:00:00 2001 From: Sahil Rajesh Shriwardhankar <102847495+notsointresting@users.noreply.github.com> Date: Sun, 22 Dec 2024 13:48:04 +0000 Subject: [PATCH 2/3] Completed second iteration --- js/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/index.js b/js/index.js index c5e8fe9..58a0ed3 100644 --- a/js/index.js +++ b/js/index.js @@ -6,6 +6,18 @@ let hacker2 = 'John' console.log("The navigator's name is "+hacker2); // // Iteration 2: Conditionals +let len_hacker1 = hacker1.length; +let len_hacker2 = hacker2.length; + +if (len_hacker1 > len_hacker2){ + console.log("The driver has the longest name, it has "+len_hacker1+" characters"); +} +else if (len_hacker1 < len_hacker2){ + console.log("It seems that the navigator has the longest name, it has "+len_hacker2+" characters"); +} +else{ + console.log("Wow, you both have equally long names, "+len_hacker1+" characters!"); +} // Iteration 3: Loops From f43f62d0f59288651faa819b2fb4769001bcd096 Mon Sep 17 00:00:00 2001 From: Sahil Rajesh Shriwardhankar <102847495+notsointresting@users.noreply.github.com> Date: Sun, 22 Dec 2024 13:51:17 +0000 Subject: [PATCH 3/3] Completed all iteration --- js/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/js/index.js b/js/index.js index 58a0ed3..2a66099 100644 --- a/js/index.js +++ b/js/index.js @@ -21,3 +21,21 @@ else{ // Iteration 3: Loops +let driverName = "John"; + +let spacedName = ""; +for (let i = 0; i < driverName.length; i++) { + spacedName += driverName[i].toUpperCase(); + if (i < driverName.length - 1) { + spacedName += " "; + } +} +console.log(spacedName); + +if (hacker1 < hacker2) { + console.log("The driver's name goes first."); + } else if (hacker1 > hacker2) { + console.log("Yo, the navigator goes first definitely."); + } else { + console.log("What?! You both have the same name?"); + }