前言
javaSE的运算符、选择语句、循环语句等都能在js使用,就不详细写在笔记里了
函数声明function
function 函数名(形参){}
<script>
function computed(n,m,op){
switch(op){
case "+":
return n+m;
break;
case "-":
return n-m;
break;
case "*":
return n*m;
break;
case "/":
return n/m;
break;
}
}
var result = computed(3,5,"*");
console.log(result);//15
</script>
标签:case,function,return,函数,break,声明,computed
From: https://www.cnblogs.com/ben10044/p/16818985.html