From 4d15f9a7c0545faab472366af967a9b1a416b80c Mon Sep 17 00:00:00 2001 From: aaghafari-dev Date: Wed, 22 Apr 2026 15:15:26 +0200 Subject: [PATCH] My homework --- index.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 6b0fec3ad..a30f0da91 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,19 @@ // Iteration 1: Names and Input +const hacker1 = "Raoul"; +console.log("The driver's name is " + hacker1); -// Iteration 2: Conditionals +const hacker2 = "Sarah"; +console.log("The navigator's name is " + hacker2); +// Iteration 2: Conditionals +const length1 = hacker1.length; +const length2 = hacker2.length; -// Iteration 3: Loops +if (length1 > length2) { + console.log("The driver has the longest name, it has " + length1 + " characters."); +} else if (length2 > length1) { + console.log("It seems that the navigator has the longest name, it has " + length2 + " characters."); +} else { + console.log("Wow, you both have equally long names, " + length1 + " characters!"); +}