Need help organizing variables and strings

So I’ve been trying to create a code from scratch with some of the stuff I’ve learned so far from the Javascript course. Here is what I wanted to do.

I wanted to make a script that collected a user response for three different variables and then displays it back to the user in a paragraph on the web page(not an alert box). How would I go about inputting multiple javascript variables into the same paragraph on the HTML side?

To gather the variables I use the following code:

  <script>
      var name = window.prompt("Enter your name: ");
      var age = window.prompt("How old are you: ");
      var location = window.prompt("Where are you from: ");

      
    </script>

Now the problem I’m running across is that I’ve tried different functions I found through google but none of them display it back in the format that I want. I want it to say something along the lines of:

You are (name), a (age) year old from (location).

What would you guys recommend would be the correct functions to use on the Javascript side and HTML side?

I figured out my issue :smile: It seems like I had a problem with the variable I named location. When I changed that to something else it worked perfectly.

1 Like