From 168bff6917af6eeb00064e89f020b3e86f47d1a4 Mon Sep 17 00:00:00 2001 From: sara faltas Date: Wed, 1 Apr 2026 17:37:21 +0200 Subject: [PATCH] resolved --- index.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 6b0fec3ad..652e426a2 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,33 @@ // Iteration 1: Names and Input - - +const hacker1 = "ella"; +console.log("the driver name is " +hacker1 ); +const hacker2= "gps" +console.log("the navigator name is " +hacker2 ); // Iteration 2: Conditionals - +// The driver has the longest name, it has XX characters. or +// - It seems that the navigator has the longest name, it has XX characters. or +// - Wow, you both have equally long names, XX characters!. +let result; +if (hacker1.length > hacker2.length){ +result = "The driver has the longest name , it has "+ hacker1.length +" characters." +} +else if (hacker1.length < hacker2.length){ + result = "It seems that the navigator has the longest name, it has XX characters" +} +else { + result = "Wow, you both have equally long names, "+ hacker2.length +" characters!" +} +console.log(result); // Iteration 3: Loops +let capitalName = " "; +for ( let i=0; i< hacker1.length ; i++){ + capitalName += hacker1[i].toUpperCase() +" "; +} +console.log(capitalName); + +let navigatorReverse = " "; +for ( let i= hacker2.length-1; i >= 0; i--){ + navigatorReverse += hacker2[i] ; +} +console.log(navigatorReverse);