+ 2
What is wrong here? (JAVASCRIPT)
function num(a,b){ document.write(a+"is greater than"+b); } var x=num(18,16); alert(x);
2 Respostas
+ 4
You are wrong.
Nah jk, it should be,
function num(a,b){
alert(a+"is greater than"+b);
}
num(18,16);
OR
function num(a,b){
return a+"is greater than"+b
}
var x=num(18,16);
alert(x);
0
function num(a,b)
{
if(a > b)
return document.write(a+"is greater than"+b);
else
return document.write(b+"is greater than"+a);
}
var x = num(18, 16);
alert(x);
works for any number .. greater or less than.