+ 2
Why output of this code is nothing?
3 odpowiedzi
+ 3
Hi! because you didn't write an output statement to the screen or to the console.
document.write()
or
console.log()
+ 2
Yep ^^ this :
console.log(sum(2,3));
+ 2
🕸carpe diem🕸 easy way to do this based on your own code.
function sum(x, y){
result = x + y;
return document.write(result);
}
sum (2, 3);
function sum(x, y){
result = x + y;
return console.log(result);
}
sum (2, 3);
which will display in the html viewer.