From 557e45ea08a3273a244c45cc238ea4c437010782 Mon Sep 17 00:00:00 2001 From: Francisco Pilosio Date: Tue, 9 Aug 2022 21:42:02 +0200 Subject: [PATCH 1/4] done_Iteration_1 --- js/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/index.js b/js/index.js index 59e4af7fb..dd2f7c7eb 100644 --- a/js/index.js +++ b/js/index.js @@ -1,6 +1,12 @@ // Iteration 1: Names and Input // -// Iteration 2: Conditionals +let hacker1 = "The driver's name is XXXX"; + +let hacker2 = "he navigator's name is YYYY"; +console.log(hacker1, hacker2); + +//console.log("I'm ready!"); +// Iteration 2: Conditionals // Iteration 3: Loops From 84bbb928bfedaad9382d78fbac0107ad162a4706 Mon Sep 17 00:00:00 2001 From: Francisco Pilosio Date: Tue, 9 Aug 2022 21:52:07 +0200 Subject: [PATCH 2/4] iteration1_updated --- js/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/index.js b/js/index.js index dd2f7c7eb..5059953ac 100644 --- a/js/index.js +++ b/js/index.js @@ -1,10 +1,11 @@ // Iteration 1: Names and Input // -let hacker1 = "The driver's name is XXXX"; +let hacker1 = "Juan"; +console.log("The driver's name is " + hacker1); -let hacker2 = "he navigator's name is YYYY"; +let hacker2 = "Matias"; -console.log(hacker1, hacker2); +console.log("The navigator's name is " + hacker2); //console.log("I'm ready!"); // Iteration 2: Conditionals From b7257fbfcc16da1f09655feaf75ed0d9dcf11fe0 Mon Sep 17 00:00:00 2001 From: Francisco Pilosio Date: Mon, 15 Aug 2022 13:01:40 +0200 Subject: [PATCH 3/4] Iteration 2 & 3 --- js/index.js | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/js/index.js b/js/index.js index 5059953ac..6079e92d3 100644 --- a/js/index.js +++ b/js/index.js @@ -1,5 +1,7 @@ +//console.log("I'm ready!"); + // Iteration 1: Names and Input -// + let hacker1 = "Juan"; console.log("The driver's name is " + hacker1); @@ -7,7 +9,45 @@ let hacker2 = "Matias"; console.log("The navigator's name is " + hacker2); -//console.log("I'm ready!"); // 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 < hacker2.length) { + console.log( + `It seems that the navigator has the longest name, it has ${hacker2.length} characters.` + ); +} else { + console.log( + `Wow, you both have equally long names, ${hacker1.length} characters!` + ); +} + // Iteration 3: Loops + +// 3.1 +// WITHOUT LOOPS: console.log(hacker1.toUpperCase().split("").join(" ")); +let inCapitalsHacker1 = ""; +for (let i = 0; i < hacker1.length; i++) { + inCapitalsHacker1 += hacker1[i]; +} +console.log(inCapitalsHacker1.toUpperCase().split("").join(" ")); + +//3.2 +// WITHOUT LOOPS: console.log(hacker2.split("").reverse().join("")); +let backwardsHacker2 = ""; +for (let i = hacker2.length - 1; i >= 0; i--) { + backwardsHacker2 += hacker2[i]; +} +console.log(backwardsHacker2); + +//3.3 +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?"); +} From 20201606b86720ce02b12275bc39e32f9734fdac Mon Sep 17 00:00:00 2001 From: Francisco Pilosio Date: Sun, 21 Aug 2022 20:18:17 +0200 Subject: [PATCH 4/4] exercise 3 amended --- js/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/index.js b/js/index.js index 6079e92d3..4847f39ee 100644 --- a/js/index.js +++ b/js/index.js @@ -44,9 +44,9 @@ for (let i = hacker2.length - 1; i >= 0; i--) { console.log(backwardsHacker2); //3.3 -if (hacker1 > hacker2) { +if (hacker1.toLowerCase < hacker2.toLowerCase) { console.log("The driver's name goes first."); -} else if (hacker1 < hacker2) { +} else if (hacker1.toLowerCase > hacker2.toLowerCase) { console.log("Yo, the navigator goes first definitely."); } else { console.log("What?! You both have the same name?");