--- title: 除法 (/) slug: Web/JavaScript/Reference/Operators/Division tags: - JavaScript - 参考 - 语言特征 - 运算符 translation_of: Web/JavaScript/Reference/Operators/Division ---
除法运算符 (/
) 计算了两个操作数的商,左边的数是被除数,右边的是除数
Operator: x / y
1 / 2 // 0.5 Math.floor(3 / 2) // 1 1.0 / 2.0 // 0.5
2.0 / 0 // Infinity 2.0 / 0.0 // Infinity, because 0.0 === 0 2.0 / -0.0 // -Infinity
Specification |
---|
{{SpecName('ESDraft', '#sec-multiplicative-operators', 'Division operator')}} |
{{Compat("javascript.operators.division")}}