diff --git a/starter-code/index.html b/starter-code/index.html index eed6a96..78fd473 100644 --- a/starter-code/index.html +++ b/starter-code/index.html @@ -11,9 +11,9 @@

Open your console!

You should see a message saying your JavaScript has loaded.

- - - + + diff --git a/starter-code/login.js b/starter-code/login.js index 3ec61ba..e0c5407 100644 --- a/starter-code/login.js +++ b/starter-code/login.js @@ -1 +1,14 @@ console.log("login.js loaded"); +var userLogin = {userName: "Ryantran", Password: "Tranvannhan1"} + +var passwordInput; +var loggedIn = false; +while (!loggedIn){ + passwordInput = prompt("Enter password for user " + userLogin.userName + ".") + if (passwordInput === userLogin.Password){ + console.log ("correct!!!"); + loggedIn = true + }else { + console.log("Try again"); + } +} \ No newline at end of file diff --git a/starter-code/security_questions.js b/starter-code/security_questions.js index 03606fe..e5481d5 100644 --- a/starter-code/security_questions.js +++ b/starter-code/security_questions.js @@ -1 +1,24 @@ console.log("security_questions.js loaded"); +var securityQuestions = [ + { + question: "What was your first pet's name?",expectedAnswer: "miki" + }, + { + question: "what is your mother name?",expectedAnswer: "Alice" + }, + { + question: "What is your first job?",expectedAnswer: "Architecture" + } +] + +var userAnswer = ""; + + +for (var i=0; i < securityQuestions.length; i++){ + userAnswer = prompt(securityQuestions[i].question); + if (userAnswer !== securityQuestions[i].expectedAnswer){ + alert("Incorrect security question!"); + + break; + } +} \ No newline at end of file diff --git a/starter-code/sing.js b/starter-code/sing.js index c656175..7a063f8 100644 --- a/starter-code/sing.js +++ b/starter-code/sing.js @@ -1 +1,9 @@ console.log("sing.js loaded"); +var numBottles = prompt("how many bottles in the wall?") +var bottles = 'bottles'; +while (numBottles > 0) { + console.log(numBottles + 'bottles' + 'of beer on the wall'); + console.log(numBottles + 'bottles' + 'of beer'); + console.log("Take one down and pass it around,"); + console.log(numBottles - 1); +} \ No newline at end of file