Add Two Number Program in JavaScript


Prev Tutorial Next Tutorial

Find Sum of Two Numbers Using JavaScript


<!doctype html>
function add(){
var a,b,c;
c= a + b;
document.getElementById("answer").value= c;
Enter the First number : <input id="first">
Enter the Second number: <input id="second">
<button onclick="add()">Add</button>
<input id="answer">


Enter First Number:
Enter Second Number:

Code Explanation

  • no=Number(document.getElementById("first").value);
    This code is used for receive first input value form input field which have id first.
  • no=Number(document.getElementById("second").value);
    This code is used for receive first input value form input field which have id second.
  • document.getElementById("answer").value= fact;
    This code is used for receive calculated value of factorial and display in input field which have id answer
  • <button onclick="add()">Add</button>
    This code is used for call add function when button clicked.

Prev Tutorial Next Tutorial


Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: or 9999595223

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements

Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: or 9999595223 Try this Keyword C++ Programs