Adding numbers and strings

I’m brand new and need help with this problem. Can someone explain to me how to correctly add the string and numbers so that the numbers also add up?

It would come out to The result is: 1020

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Numbers</h2>

<p>A common mistake is to expect this result to be 30:</p>

<p id=“demo”></p>

<script>
var x = 10;
var y = 20;
document.getElementById(“demo”).innerHTML =
"The result is: " + x + y;
</script>

</body>
</html>

It may work if you add parenthesis around the variables that hold the numbers, or you will need to create a different variable that holds the result of the sum and concatenate that to the string

1 Like

Ahh the parenthesis worked. But using another var for the string didn’t work, unless i added the parenthesis again. Thank you!

Oh I see, that makes sense. thank you!
What i thought she meant and did was make a var holding the string "The result is: " which didnt work