6_1. Create a Web page that does the following. Write a function combine Words(w
ID: 3569028 • Letter: 6
Question
6_1. Create a Web page that does the following. Write a function combine
Words(word1,word2) that displays both words (i.e. the words in the parameters) in
an alert box with a space between them. Be sure to place the function declaration in the head
section of your document, inside script tags.
Then in the body section, add script tags and include JavaScript code that prompts the user to
input two words. Store this input in two variables, word1 and word2. Then write a function
call to combineWords, passing the value
Explanation / Answer
<html>
<head>
<title>Javascript Code Enabled Function</title>
<script>
function combineWords(word1,word2)
{
alert(word1 + " " + word2);
}
</script>
</head>
<body>
<script>
function promptUser()
{
var word1=prompt('Enter First Word:');
var word2=prompt('Enter Second Word:');
combineWords(word1,word2);
}
</script>
<h1>Chegg Test</h1>
<br>
<button>Click Me!</button>
</body>
</html>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.