0

Hello I am making an alert that shows the addition of Number(num1) + Number(num2) in an alert box it comes up with what the user inputted and result but I was wondering how would I code it to show the whole equation, for example, "2 + 2 = 4" If the user put in 2 and 2.

I know how to get it to show the result but how can I make it show the numbers the user put in to get that result?

Nakayuma
  • 29
  • 4

1 Answers1

0

Assuming I understand what you want to do:

a = prompt('first number');
b = prompt('second number');
alert( a + '+' + b + '=' + (parseInt(a)+parseInt(b)));
dave
  • 62,300
  • 5
  • 72
  • 93