Just doing some practice and I cannot seem to get this button to function. I have checked multiple sites and seem to be formatting it right. Everything else in my code works properly.
Here is the code:
<html>
<head>
<title>This is a picoCTF JS Example</title>
<script>
function myFunctionSum(){
var number1 = document.getElementById("number1").value;
var number2 = document.getElementById("number2").value
car result = number(number1) + Number(number2);
alert(result);
}
</script>
</head>
<body>
<h1>JavaScript example to add2 numbers</h1>
Input the first number<br>
<input type="text" id="number1" ><br>
Input the second number<br>
<input type="text" id="number2"
<button onclick="myFunctionSum()"> Show alert! </button>
</body>
</html>
It is the button portion that seems to not be working. Appreciate all the help.
car result = number(number1) + Number(number2);
its wrong
try this
var result= +number1 + +number2 ;