diff --git a/Challenges/Week2/README.md b/Challenges/Week2/README.md index d8830c1..2386e56 100644 --- a/Challenges/Week2/README.md +++ b/Challenges/Week2/README.md @@ -1,7 +1,20 @@ Try and do all of the following: +<<<<<<< HEAD + +-Prompt the user for input and store that into a variable + +-Pass that value into a function + +-If the user entered 'Hello' into the prompt, alert the user with 'Hello World!' + +-If they entered anything else, alert with a different message of your choice (such as "Incorrect input!" + +-Don't forget to call your script file from this HTML file! I've created the script tags for you, but you have to add something to it! +======= Prompt the user for input and store that into a variable Pass that value into a function If the user entered 'Hello' into the prompt, alert the user with 'Hello World!' If they entered anything else, alert with a different message Don't forget to call your script file from this HTML file! I've created the script tags for you, but you have to add something to it! +>>>>>>> refs/remotes/CodeLouisville/master diff --git a/Challenges/Week2/app.js b/Challenges/Week2/app.js index 146acc5..a2a83a6 100644 --- a/Challenges/Week2/app.js +++ b/Challenges/Week2/app.js @@ -6,3 +6,25 @@ //Call function //Alert user results + +/* -Prompt the user for input and store that into a variable + +-Pass that value into a function + +-If the user entered 'Hello' into the prompt, alert the user with 'Hello World!' + +-If they entered anything else, alert with a different message of your choice (such as "Incorrect input!" + +-Don't forget to call your script file from this HTML file! I've created the script tags for you, but you have to add something to it! +*/ + +function hello() { + var sayHello = prompt(); + if (sayHello === 'Hello') { + alert('Hello World'); + document.write("you did it!") + } else { + alert("Incorrect input!"); + } +} +hello(); 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 @@