-1

I've made a calculator and it is ok. It is showing the results but I want to add a text together with the results. For exemple:

You spend "variable result" dollars in the transaction.

The results appear after I click in the calculate button. And I want the same thing for this text. Everything appear together after clicking on the button.

What I'm using to show the results

document.querySelector("#example").innerHTML = pri_gra;
Trooller
  • 179
  • 1
  • 2
  • 9

2 Answers2

0

The way to print a variable and text together is like so:

 console.log("This is the text", variableName);

or

var b = 30;
console.log(`This is the text, and ${b} is the variable`);
0

You can do like below

document.querySelector("#example").innerHTML = "You spend " + pri_gra + " dollars in the transaction.";