Instructions:
Use JavaScript and HTML to complete the following instructions on this page.
1. Display to console
- Create a function called displayMessage()
- The function will display the following "Skill Test - Output Functions" in the console.
- Call the function during run time.
2. Display City name
- Create a function called outputCityName()
- The function will accept one parameter called inCityName
- Concatenate "You live in" with the input value
- Output the new string in the console.
- Call the function during run time. Pass "Ames" into the function.
- Call the function during run time. Pass "Altoona" into the function.
3. Return a value
- Create a function called formatOrder()
- It will accept two parameters called productName and productQuantity
- Use the two input values to concatenate a string that says: "You have ordered productQuantity copies of productName".
- return the formatted message
- Call the function during run time within a console.log(). Pass in "Red Stapler" and 7 for the input values.
4. Run functions with a button click
- Apply the onclick event handler to the buttons.
- Call the outputCityName( ) with the event handler on the Display WDM button. Pass in "West Des Moines" as the parameter when called.
- Call the outputCityName( ) with the event handler on the Display Bondurant button. Pass in "Bondurant" as the parameter when called.