1.实现两个数字的加减乘除
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title>
</head><body><script>let num1 = prompt('请输入第一个数字:')let fh = prompt('请输入符号')let num2 = prompt('请输入第二个数字:')switch(fh) {case '+': alert(parseFloat(num1) + parseFloat(num2));break;case '-': alert(num1 - num2);break;case '*': alert(num1 * num2);break;case '/': alert(num1 / num2);break;}</script>
</body></html>