From 97d369f25790bd9c0fba745db9b682be384a0402 Mon Sep 17 00:00:00 2001 From: jspsegarra Date: Tue, 9 Aug 2022 21:27:34 +0200 Subject: [PATCH 1/4] done --- js/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/index.js b/js/index.js index 59e4af7fb..6c409735d 100644 --- a/js/index.js +++ b/js/index.js @@ -1,3 +1,4 @@ +console.log("I'm ready!"); // Iteration 1: Names and Input // // Iteration 2: Conditionals From f75bb5532fbe05f8f2b4bfb784280b448bc1000d Mon Sep 17 00:00:00 2001 From: jspsegarra Date: Thu, 11 Aug 2022 21:52:58 +0200 Subject: [PATCH 2/4] =?UTF-8?q?Correcci=C3=B3n=20Itineration=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/index.js b/js/index.js index 6c409735d..a651587a0 100644 --- a/js/index.js +++ b/js/index.js @@ -1,4 +1,12 @@ -console.log("I'm ready!"); +let hacker1 = "Josep"; + console.log(`The driver's name is ${hacker1}`); +let hacker2 = "Maria"; + console.log(`The navigator's name is ${hacker2}`); + + + + + // Iteration 1: Names and Input // // Iteration 2: Conditionals From 15466b9ab69f7b637f3938b1dbf614d9c4cfd7c1 Mon Sep 17 00:00:00 2001 From: jspsegarra Date: Fri, 12 Aug 2022 18:49:18 +0200 Subject: [PATCH 3/4] =?UTF-8?q?Iteraci=C3=B3n=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/index.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/js/index.js b/js/index.js index a651587a0..941584a21 100644 --- a/js/index.js +++ b/js/index.js @@ -1,15 +1,22 @@ +// Iteration 1: Names and Input + let hacker1 = "Josep"; console.log(`The driver's name is ${hacker1}`); -let hacker2 = "Maria"; +let hacker2 = "Marina"; 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 < 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 1: Names and Input -// -// Iteration 2: Conditionals - - -// Iteration 3: Loops +// Iteration 3: Loops \ No newline at end of file From 8796a6e08f46d1b375816ecc8f93a379f7b3dfaa Mon Sep 17 00:00:00 2001 From: jspsegarra Date: Fri, 12 Aug 2022 20:05:43 +0200 Subject: [PATCH 4/4] Iteration 3 --- js/index.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/js/index.js b/js/index.js index 941584a21..9613863f4 100644 --- a/js/index.js +++ b/js/index.js @@ -19,4 +19,35 @@ else { console.log("Wow, you both have equally long names, ", hacker1.length, " characters!"); } -// Iteration 3: Loops \ No newline at end of file +// Iteration 3: Loops + +// 3.1.: + +let driversName = ""; +for (let i=0; i < hacker1.length; i++) { + driversName += hacker1[i].toUpperCase() + ""; +} +console.log(driversName.trim()); + +// 3.2.: + +let navigatorsName = ""; +for (let i = hacker2.length - 1; i >= 0; i--) { + navigatorsName += hacker2[i]; +} +console.log(navigatorsName); + +// 3.3.: + +hacker1 = hacker1.toLowerCase(); +hacker2 = hacker2.toLowerCase(); + +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?") +} \ No newline at end of file