各位大神,请问为什么如果将这里的3个var摆在函数外面,无论value等于多少都是default?
求解答~~
function basicOp(operation, value1, value2) {
var operation = "+";
var value1 = 2;
var value2 = 3;
switch (operation) {
case '+':
return value1 + value2;
case '-':
return value1 - value2;
case '*':
return value1 * value2;
case '/':
return value1 / value2;
default:
return 0;
}
};
console.log(basicOp());
牛魔王的故事
相关分类