From 433c898cbe0573b2de2e456bfc3bfba22f24964b Mon Sep 17 00:00:00 2001 From: Lua Varela Date: Tue, 9 Aug 2022 21:38:00 +0200 Subject: [PATCH 1/2] done js first lab --- js/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/index.js b/js/index.js index 59e4af7fb..3bd723cab 100644 --- a/js/index.js +++ b/js/index.js @@ -4,3 +4,5 @@ // Iteration 3: Loops +let nombre = "Lua" +console.log(nombre) From e5541aab048c27afcd67c812a9432c216f68d8a2 Mon Sep 17 00:00:00 2001 From: Lua Varela Date: Fri, 12 Aug 2022 15:05:22 +0200 Subject: [PATCH 2/2] JS exercise --- js/index.js | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/js/index.js b/js/index.js index 3bd723cab..f23f23c29 100644 --- a/js/index.js +++ b/js/index.js @@ -1,8 +1,32 @@ // Iteration 1: Names and Input // + +let hacker1 = "Lua"; +console.log(`The driver's name is ${hacker1}`); + +let hacker2 = "Luis"; +console.log(`The navigator's name is ${hacker2}`); + // Iteration 2: Conditionals +if (hacker1.length < hacker2.length) { + console.log( + `It seems that the navigator has the longest name, it has ${hacker2.length} characters` + ); +} // Iteration 3: Loops -let nombre = "Lua" -console.log(nombre) + +let DriverNameSeparate = ""; +for (let i = 0; i < hacker1.length; i++) { + DriverNameSeparate += hacker1[i].toUpperCase() + " "; +} + +console.log(DriverNameSeparate.trim()); + +let NavigatorNameReverse = ""; +for (let i = hacker2.length -1; i >= 0; i--) { + NavigatorNameReverse += hacker2[i]; +} + +console.log(NavigatorNameReverse);