diff --git a/starter-code/index.html b/starter-code/index.html index eed6a96..d9a70d5 100644 --- a/starter-code/index.html +++ b/starter-code/index.html @@ -13,7 +13,7 @@ - + diff --git a/starter-code/login.js b/starter-code/login.js index 3ec61ba..7ab2ef8 100644 --- a/starter-code/login.js +++ b/starter-code/login.js @@ -1 +1,23 @@ console.log("login.js loaded"); + + +var userObject = {userName: "Batman", password: "Gotham"} + +var enterPassword; + +var loggedIn = false; + +while (!loggedIn){ + enterPassword = prompt("Enter password for user " + userObject.userName + "."); + if (enterPassword === userObject.password){ + console.log("Welcome Back"); + loggedIn = true; + } else { + console.log("Passwords do not match. Try Again!"); + } +} + + + + + diff --git a/starter-code/security_questions.js b/starter-code/security_questions.js index 03606fe..d5cd6c3 100644 --- a/starter-code/security_questions.js +++ b/starter-code/security_questions.js @@ -1 +1,25 @@ console.log("security_questions.js loaded"); + +var securityQuestions = [ +{ question: "Where was your last vacation at?", expectedAnswer: "Osaka" }, +{ question: "What is was your favorite ice cream?", expectedAnswer: "Rocky Road" }, +{ question: "What street do you live on?", expectedAnswer: "11th Avenue" } +]; + +var answer = ""; +var wrongPerson = false; + +// window.prompt(securityQuestions[0].question); +for (let i = 0 ; i < securityQuestions.length; i=i+1){ + let answer = window.prompt(securityQuestions[i].question); + console.log(answer); + if (answer !== securityQuestions[i].expectedAnswer){ + alert("Incorrect!"); + wrongPerson = true; + break; + } +} +if (wrongPerson){ + console.log("Stop!"); +} + diff --git a/starter-code/sing.js b/starter-code/sing.js index c656175..9e1f97f 100644 --- a/starter-code/sing.js +++ b/starter-code/sing.js @@ -1 +1,22 @@ console.log("sing.js loaded"); + +var userBottle = prompt("How many bottles of beer on the wall?"); + +var wallBottles = "bottles"; +while (numBottle > 0){ +console.log(userBottle + “ “ + wallBottles + “ of beer on the wall,”); +console.log(userBottle + “ “ + wallBottles + “ of beer!”); +console.log(“Take one down and pass it around, + userBottle + “ bottles of beer on the wall!”); + +userBottles = userBottles - 1; +if (userBottles === 1){ +bottles = “bottle” +} +if (userBottles === 0){ +console.log(“No more bottles of beer on the wall.”) +} +} + + + +