Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nov 28 HW Patrick #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion starter-code/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- <script type="text/javascript" src="login.js"></script> -->
<!-- <script type="text/javascript" src="security_questions.js"></script> -->
<!-- <script type="text/javascript" src="sing.js"></script> -->
<script type="text/javascript" src="sing.js"></script>

</body>
</html>
22 changes: 22 additions & 0 deletions starter-code/login.js
Original file line number Diff line number Diff line change
@@ -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!");
}
}





24 changes: 24 additions & 0 deletions starter-code/security_questions.js
Original file line number Diff line number Diff line change
@@ -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!");
}

21 changes: 21 additions & 0 deletions starter-code/sing.js
Original file line number Diff line number Diff line change
@@ -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.”)
}
}