diff --git a/index.js b/index.js index 6b0fec3ad..1f3cdd9a1 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,61 @@ // Iteration 1: Names and Input +const hacker1 = "Pari"; +//console.log(`The driver's name is ${hacker1}`); +const hacker2 = "Pari"; +//console.log(`The navigator's name is ${hacker2}`); + +// Iteration 2: Conditionals; +if(hacker1.length>hacker2.length) { + //console.log(`The driver has the longest name, it has ${hacker1.length} characters.`) +} +else if(hacker1.length= 0; i--){ +// reversed += hacker2[i]; +// } +// console.log(reversed); + +//3.3 Depending on the lexicographic order of the strings, print: +let result = "" + +for(let i = 0; i < Math.min(hacker1.length, hacker2.length); i++){ + if(hacker1[i]hacker2[i]){ + result = "Yo, the navigator goes first, definitely." + //console.log() + break;} + // else if(hacker1[i] === hacker2[i]){ + // console.log("What?! You both have the same name?") + // } +} + +if(result !== ""){ + console.log(result) +}else{ + console.log("What?! You both have the same name?") +} \ No newline at end of file