From 0d5a0d97a951791d809bb77ed283f88917631bdd Mon Sep 17 00:00:00 2001 From: Cesar Aparicio Date: Tue, 24 Oct 2017 21:40:01 +0200 Subject: [PATCH 1/2] done --- starter-code/basic-algorithms.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/starter-code/basic-algorithms.js b/starter-code/basic-algorithms.js index 82f20d8ba..810b652bc 100644 --- a/starter-code/basic-algorithms.js +++ b/starter-code/basic-algorithms.js @@ -1,7 +1,4 @@ -// Names and Input - - -//Conditionals - - -// Lorem ipsum generator +var hacker1 = "Juancho"; +console.log("The driver's name is " + hacker1); +var hacker2 = prompt("What's the navigator name?"); +console.log ("The navigator's name is " + hacker2); From afd8ec769f27e7ab1b86eb2fa2cb75ed6e3be239 Mon Sep 17 00:00:00 2001 From: Cesar Aparicio Date: Thu, 2 Nov 2017 15:39:10 +0100 Subject: [PATCH 2/2] done --- starter-code/basic-algorithms.js | 41 ++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/starter-code/basic-algorithms.js b/starter-code/basic-algorithms.js index 810b652bc..c28140e7c 100644 --- a/starter-code/basic-algorithms.js +++ b/starter-code/basic-algorithms.js @@ -1,4 +1,41 @@ var hacker1 = "Juancho"; console.log("The driver's name is " + hacker1); -var hacker2 = prompt("What's the navigator name?"); -console.log ("The navigator's name is " + hacker2); +var hacker2 = prompt("What's your name navigator"); +console.log("The navigator name is " + hacker2); + +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("The navigator got the longest name, it has " + hacker2.length + " characters"); +} +else { +console.log ("wow, you both got equally long names, " + hacker1.length + "characters!!"); +} +var UpperCase = ""; +console.log(hacker1.toUpperCase()); + +var UpperCase = ""; +var splitUpper = UpperCase.split(); +console.log(splitUpper); + +//¿Por qué es necesario un loop para hacer un reverse? + + +var upper = ""; +for (var i = 0; i < hacker1.lenght; i++) { + upper += hacker[i].toUppercase(); + if (i < hacker1.lenght -1) { + upper += ""; + } +} +//no entiendo el motivo del += si ya he metido el i++ +console.log (uppper); + +var upperRev = ""; +for ( var i = hacker2.lenght -1; i <= 0; i--) { + upperRev += hacker2[i]; +} +console.log(upperRev); + +