Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript

I can't figure out the solution.

"<h2>There once was a [adjective] programmer who wanted to use JavaScript to [verb] the [noun].</h2>"

var objective = prompt("Please type an abjective");
var verb = prompt("Please type a verb");
var noun = prompt("please type a noun");
alert("All Finished");
var sentence = "<h2> There once was a " + objective;
sentence = +- "programmer who wanted to use JavaScript to " + verb + "the " + noun + "." </h2>"
Document.write (sentence);

1 Answer

Luis Henrique Witz
Luis Henrique Witz
16,505 Points

Hi friend,

This is what you trying to do?

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>

  </head>
  <body>
    <h2 id="sentence"></h2>
  </body>
  <script type="text/javascript">
    var adjective = prompt("Please type an adjective");
    var verb = prompt("Please type a verb");
    var noun = prompt("please type a noun");
    alert("All Finished");
    var sentence = "There once was a " + adjective + " programmer who wanted to use JavaScript to " + verb + "the " + noun + ".";
    document.getElementById("sentence").innerHTML = sentence;
  </script>
</html>