diff --git a/apps.js b/apps.js index 40a66e6..ae7fb85 100644 --- a/apps.js +++ b/apps.js @@ -54,3 +54,41 @@ if (question5 === 'yes') { let question6 = prompt('What is your name?'); document.write('

Hello! '+ question6 + '

'); + +//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