Skip to content

Commit

Permalink
almost
Browse files Browse the repository at this point in the history
  • Loading branch information
maradychor committed Jan 25, 2024
1 parent 47625c8 commit 4bafae2
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,41 @@ if (question5 === 'yes') {

let question6 = prompt('What is your name?');
document.write('<p>Hello! '+ question6 + '</p>');

//end part 1

let userNumberGuess = prompt('Guess how old I am');
let correctNumber = 27;

if (userNumberGuess > correctNumber) {
alert('Not that old');
} else if (userNumberGuess < correctNumber) {
alert('Not that young');
} else {
alert('You are correct');
}
//need to finish


//this is part 3
const possibleAnswers = ["pho", "curry", "hot pot", "korean bbq"];
const maxAttempts = 6;
let attempts = 0;

while (attempts < maxAttempts) {
const userGuess = prompt("guess my favorite asian food");

if (possibleAnswers.includes(userGuess)) {
alert("That is one of my favorites!!!");
break;
} else {
alert('Im not sure about that!');
}

attempts++;
}
if (attempts === maxAttempts) {
alert('sorry! youre wrong there are no more tries');
}

//part 4

0 comments on commit 4bafae2

Please sign in to comment.