From 7d9f8e78924108722bc449c85fa515a867c5f0eb Mon Sep 17 00:00:00 2001 From: Lexy Vanderford Date: Mon, 22 Jan 2018 15:13:40 -0500 Subject: [PATCH 1/3] Implement code changes --- starter-code/basic-algorithms.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/starter-code/basic-algorithms.js b/starter-code/basic-algorithms.js index 82f20d8ba..28f7b2d44 100644 --- a/starter-code/basic-algorithms.js +++ b/starter-code/basic-algorithms.js @@ -1,7 +1,3 @@ -// Names and Input +var hacker1 = "Lexy"; +console.log("The drivers name is " + hacker1); - -//Conditionals - - -// Lorem ipsum generator From a606dcf9d3566b5c9564641de7c9af0117acbc64 Mon Sep 17 00:00:00 2001 From: Lexy Vanderford Date: Mon, 22 Jan 2018 16:01:15 -0500 Subject: [PATCH 2/3] Implement code changes --- starter-code/basic-algorithms.js | 74 +++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/starter-code/basic-algorithms.js b/starter-code/basic-algorithms.js index 28f7b2d44..7f928f798 100644 --- a/starter-code/basic-algorithms.js +++ b/starter-code/basic-algorithms.js @@ -1,3 +1,73 @@ -var hacker1 = "Lexy"; -console.log("The drivers name is " + hacker1); +//1.Create a driver variable +var hacker1 = "Lexy"; + +//2. Print driver +console.log("The driver name is " + hacker1); + +//3. Create navigator's name +var hacker2 = window.prompt("What is your name?"); + +//4. Print navigator +console.log("The navigator's name is " + hacker2); + +//5. If hacker1 or hacker2 has the longest name +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("Yo, navigator got the longest name, it has " + hacker2.length + " characters"); +} +else { + console.log("wow, you both got equally long names, " + hacker1.length + " characters"); +} + +//6.Print driver characters separate by a space and in capitals +var temp = ""; // +for(var i = 0; i < hacker1.length; i++){ + if(i === hacker1.length-1){ + temp += (hacker1[i].toUpperCase()); + } + else { + temp += (hacker1[i].toUpperCase()) + " "; + } +} +console.log(temp); + +//7. Print navgator's name in reverse +temp = ""; +for(i = hacker2.length-1; i >= 0; i--){ + temp += hacker2[i]; +} +console.log(temp); + +//8.Determining the lexicographic order +if(hacker1.charCodeAt(0) < hacker2.charCodeAt(0)){ + console.log("Yes, it is smaller") +} + + + + + + + + + + + + + + + + + + + + + + + + + + From 0ef37544994b5e8e852bce02e73c1782a3d1403b Mon Sep 17 00:00:00 2001 From: Lexy Vanderford Date: Tue, 23 Jan 2018 09:32:19 -0500 Subject: [PATCH 3/3] update --- starter-code/basic-algorithms.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starter-code/basic-algorithms.js b/starter-code/basic-algorithms.js index 7f928f798..69dc11775 100644 --- a/starter-code/basic-algorithms.js +++ b/starter-code/basic-algorithms.js @@ -42,7 +42,7 @@ console.log(temp); //8.Determining the lexicographic order if(hacker1.charCodeAt(0) < hacker2.charCodeAt(0)){ - console.log("Yes, it is smaller") + console.log("Yes, it is smaller"); }