Website under maintenance!

Calling function in JavaScript

Posted on September 22, 2016 - Tags: , ,

The following function AddNumebers will return the result of summation of parameters, num1 = 1 and num2 = 2

The last line of the code below will return the result from the function, ‘AddNumbers’ into the CSS id selector ‘calculator’

<div id="calculator"> </div>

function AddNumbers(num1, num2) { // myFunction with two paramenters
return num1 + num2;
document.getElementById("calculator").innerHTML = AddNumbers(1, 2);