Skip to content
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
31 changes: 29 additions & 2 deletions Challenges/Week2/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
//create function
//control and return statements

//Prompt user for input and store variable

//control and return statements

function processInput(message)
{
if(message === "hello!")
{
return("Hello World!");
}
else {

return("You Suck :(");
}
}




var userInput;

userInput = prompt();


var response = processInput(userInput);

console.log(response);


//Call function



//Alert user results
6 changes: 3 additions & 3 deletions Challenges/Week2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
<h2>My first code challenge!</h2>
</div>
<p>Try and do all of the following:</p>
<ol>
<ul>
<li>Prompt the user for input and store that into a variable</li>
<li>Pass that value into a function</li>
<li>If the user entered 'Hello' into the prompt, alert the user with 'Hello World!'</li>
<li>If they entered anything else, alert with a different message
<li>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!
</ol>
</ul>

<script></script>
<script src="app.js"></script>
</body>
</html>