I am pretty new in JavaScript and I have a litle doubt.
I have created this JSFiddle: https://jsfiddle.net/AndreaNobili/1up938xf/
I have defined only the JavaScript function that perform a simple sum (no HTML) and that show the result into a popup by an alert
var add = function(x, y) {
z = z + y;
return z;
}
var sum = add(2, 3);
alert(sum);
The problem is that when I try to run this test application I can't see anything. Why? What am I missing?
alert()
function for safety reasons. Tryconsole.log()
and open up your dev console to see test output – Sukima Jun 20 '15 at 17:06