javascript add 2 numbers code example
Example 1: how to add two numbers in javascript
let a = 4;
let b = 5;
document.write(a + b);
Example 2: adding numbers in Javscript
return a+b;
Example 3: 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);