From 06f1e14b41a3067ebdb252ecf6c937bbdaaf910f Mon Sep 17 00:00:00 2001 From: FrankIsmael Date: Mon, 25 Mar 2019 18:00:00 -0600 Subject: [PATCH 1/2] Ejercicio terminado --- starter-code/basic-algorithms.js | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/starter-code/basic-algorithms.js b/starter-code/basic-algorithms.js index 82f20d8ba..1938e9548 100644 --- a/starter-code/basic-algorithms.js +++ b/starter-code/basic-algorithms.js @@ -1,7 +1,33 @@ -// Names and Input +let driverName='Ismael' +console.log(`The drivers is ${driverName}`) +const navigatorName = prompt("Dime tu nombre") +console.log(`The navigators name is: ${navigatorName}`) +if(driverName.length > navigatorName.length){ + console.log(`The Driver has the longest name, it has ${driverName.length} characters`) +} else if(driverName.length < navigatorName.length){ + console.log(`Yo, navigator got the longest name, it has ${navigatorName.length} characters`) +} else{ + console.log(`wow, you both got equally long names, ${driverName.length} characters!!`) +} -//Conditionals +let nuevoName = ''; +for (i =0; i < driverName.length; i++){ + nuevoName += driverName[i] + ' ' +} +console.log(nuevoName.toUpperCase()) -// Lorem ipsum generator +let nuevoN='' +for(j=1;j <= navigatorName.length ; j++){ + nuevoN += navigatorName[navigatorName.length - j] +} +console.log(nuevoN) + +if(driverName < navigatorName){ + console.log(`The driver's name goes first`) +} else if(driverName > navigatorName){ + console.log(`Yo, the navigator goes first definitely`) +} else{ + console.log(`What?! You both got the same name?`) +} From b57990ded80a9f685284f17f43855d86ea48efda Mon Sep 17 00:00:00 2001 From: ta-web-mex <35221964+ta-web-mex@users.noreply.github.com> Date: Tue, 26 Mar 2019 09:52:42 -0600 Subject: [PATCH 2/2] Update basic-algorithms.js --- starter-code/basic-algorithms.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/starter-code/basic-algorithms.js b/starter-code/basic-algorithms.js index 1938e9548..daca10669 100644 --- a/starter-code/basic-algorithms.js +++ b/starter-code/basic-algorithms.js @@ -16,9 +16,9 @@ for (i =0; i < driverName.length; i++){ nuevoName += driverName[i] + ' ' } -console.log(nuevoName.toUpperCase()) +console.log(nuevoName.toUpperCase()) //Bien, pero si notan les va a sobrar un espacio al final. Pueden removerlo con un .slice(0,-1) o un .trim() -let nuevoN='' +let nuevoN='' //Traten de ser más explícito en los nombres de las variables, así va a ser más fácil entender qué hacen for(j=1;j <= navigatorName.length ; j++){ nuevoN += navigatorName[navigatorName.length - j] }