I watched tutorials on JavaScript and I'm done now but have already messed up my program. It is just a very simple addition thing. But for some reason, it literally puts the two entered numbers together instead of adding them. I am a complete noob. Here's the code:
<script type="text/javascript">
alert("Welcome to my JavaScript additon program, please click OK.");
var first = prompt("Enter your first number", "");
var second = prompt("Enter our second number", "");
var answer = first + second;
alert(first + " + " + second + " is " + answer );
</script>
Could someone tell me what I am doing wrong.
Many thanks.


Sign In
Create Account

Back to top









