diff --git a/Challenges/Week2/app.js b/Challenges/Week2/app.js index 146acc5..2ba3a33 100644 --- a/Challenges/Week2/app.js +++ b/Challenges/Week2/app.js @@ -6,3 +6,28 @@ //Call function //Alert user results +var $correct = false; +alert("Greetings friend!"); + +var $input = function(){ + $guess = 0; + while(!$correct){ + $userInput = prompt("We sincerely request your valuable input: "); + $response = "HELLO"; + if($userInput.toUpperCase() == $response){ + alert($userInput + " World"); + $correct = true; + console.log("Guess:" + $guess); + } else{ + alert("Sorry, that is not the valuable input we were hoping for:"); + var $tryAgain = prompt("Would you like to quit: yes or no?"); + $guess++; + if($tryAgain.toUpperCase() == 'NO' || $tryAgain.toUpperCase() == 'N' ){ + break; + } + } + } + return $guess; +} + +$input(); \ No newline at end of file diff --git a/Challenges/Week2/index.html b/Challenges/Week2/index.html index afe8e37..2f1bae7 100644 --- a/Challenges/Week2/index.html +++ b/Challenges/Week2/index.html @@ -15,6 +15,6 @@