There are three variables as follows
var a=1;
var b=-2;
var c=4;
If I performed following options
var Res=a*b*c;
Or
var Res=a+b+c;
然后,如果结果是-ve值显示 - 在警告框中,如果结果是+ ve 值显示+在警告框中
答案 0 :(得分:0)
var a=1;
var b=-2;
var c=4;
var Res1=a*b*c;
var Res2=a+b+c;
function alertPlusOrMinus(n) {
if( n < 0 ){
alert('-');
} else {
alert('+');
}
}
alertPlusOrMinus( Res1 );
alertPlusOrMinus( Res2 );
&#13;