add two numbers in javascript
const num1 = 5;
const num2 = 3;
// add two numbers
const sum = num1 + num2;
// display the sum
console.log('The sum of ' + num1 + ' and ' + num2 + ' is: ' + sum);
add two numbers in javascript
const num1 = 5;
const num2 = 3;
// add two numbers
const sum = num1 + num2;
// display the sum
console.log('The sum of ' + num1 + ' and ' + num2 + ' is: ' + sum);
how to add two numbers in javascript
let a = 4;
let b = 5;
document.write(a + b);
add variable numerically in javascript
//use parseFloat(x); to change string to number
a=10;
b=20;
console.log(parseFloat(a)+parseFloat(b));//this will give a+b=30
//while
consle.log(a+b); //will give a+b=1020 [as String]
javascript function to add two numbers
<!--Add two integer numbers using JavaScript.-->
<html>
<head>
<title>Add two integer numbers using JavaScript.</title>
<script type="text/javascript">
function addTwoNumbers(textBox1, textBox2){
var x=document.getElementById(textBox1).value;
var y=document.getElementById(textBox2).value;
var sum=0;
sum=Number(x)+Number(y);
alert("SUM is: " + sum);
}
</script>
</head>
<body>
<h1>Add two integer numbers using JavaScript.</h1>
<b>Enter first Number: </b><br>
<input type="text" id="textIn1"/><br>
<b>Enter second Number: </b><br>
<input type="text" id="textIn2"/><br><br>
<input type="button" id="btnSum" value="Calculate SUM" onClick="addTwoNumbers('textIn1','textIn2')"/>
</body>
</html>
how to add 2 numbers together in javascript
var x = +y + +z;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us