<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
//写一个函数,用户输入任意两个数字的任意算术运算,并弹出运算后的结果
function get(num1,symbol,num2){
switch(symbol){
case '+':
return num1 + num2;
break;
case '-':
return num1 - num2;
break;
case "*":
return num1 * num2;
break;
case "/":
return num1 / num2;
break;
}
}
alert(get(3,'/',6));
</script>
</head>
<body>
</body>
</html>
写一个函数,用户输入任意两个数字的任意算术运算,并弹出运算后的结果(javascript)
最新推荐文章于 2022-08-05 10:33:19 发布