From cb3300d315395fd03a0475b9544c44e05deac4d9 Mon Sep 17 00:00:00 2001 From: laggart Date: Tue, 9 Aug 2022 21:50:26 +0200 Subject: [PATCH 1/2] Names and Inputs realizado --- js/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/js/index.js b/js/index.js index 59e4af7fb..5c86fc00b 100644 --- a/js/index.js +++ b/js/index.js @@ -4,3 +4,19 @@ // Iteration 3: Loops + +//Iteration 1:----------------------------// + +let hacker1 = 'Juan Carlos'; +console.log('the driver is', hacker1); + +let hacker2 = 'Nadie' +console.log('The navigator is', hacker2); + +////Iteration 2:----------------------------// + +if{ + +} + + From 9b1d2fe0c5b2ddd0bf803778d0df96a6ffd3cc16 Mon Sep 17 00:00:00 2001 From: laggart Date: Thu, 11 Aug 2022 23:59:21 +0200 Subject: [PATCH 2/2] Iteration 2 y 3 ready --- js/index.js | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/js/index.js b/js/index.js index 5c86fc00b..6bc636316 100644 --- a/js/index.js +++ b/js/index.js @@ -15,8 +15,46 @@ console.log('The navigator is', hacker2); ////Iteration 2:----------------------------// -if{ +let driverNameLength = hacker1.length +let navigatorNameLength = hacker2.length + +if (driverNameLength > navigatorNameLength) { + console.log('the driver has the longest name, it has,', driverNameLength, 'characters') +} else if (driverNameLength < navigatorNameLength) { + console.log('it seems that the navigator has the longest name, it has', navigatorNameLength, 'characters!') +} else { + console.log ('Wow, you both have equally long names,', driverNameLength, 'characters') +} + + +////Iteration 3:----------------------------// + +let upperHacker1 = hacker1.toUpperCase(); + +let i=0 +while (i < driverNameLength){ + console.log(upperHacker1[i], " ") + i++; +} + +let space = '' + space = hacker1.toUpperCase().split('').join(' '); + console.log(space); + +let reverseName = '' + + reverseName = hacker1.split('').reverse().join('') + console.log(reverseName); + +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?") } + +