请问var result=“”;中为什么给result初始化为“”
function count(){
var a = document.getElementById("txt1").value;
var b = document.getElementById("txt2").value;
var c= document.getElementById("select").value;
var result ="" ;
switch(c) {
case "+":
result = parseFloat(a) + parseFloat(b);
break;
case "-":
result = parseFloat(a) - parseFloat(b);
break;
case "*":
result = parseFloat(a) * parseFloat(b);
break;
default:
result = a/b;
}
document.getElementById("fruit").value = result;
}