Skip to content

Commit cab6d3e

Browse files
authored
Update README.md
1 parent 651bbc7 commit cab6d3e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

source/basic/operator/README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,14 @@ console.log(10 * 0.5); // => 5
111111
```js
112112
console.log(8 / 2); // => 4
113113
console.log(10 / 0.5); // => 20
114-
115-
// 正の無限大
116-
console.log(10 / 0); // => Infinity
117-
console.log(-10 / -0); // => Infinity
118-
// 負の無限大
119-
console.log(-10 / 0); // => -Infinity
120-
console.log(10 / -0); // => -Infinity
121114
```
122115

123-
0で除算した場合、無限大を表す数値である`Infinity`として評価されます。
124-
演算結果が0未満で表される場合は、負の無限大を表す`-Infinity`となります。
116+
ただし、任意の数値を`0`で除算した結果は、無限大を表す数値である`Infinity`となります。
125117

126-
四則演算において、式の一部でInfinityと評価されてしまうと、式全体の演算結果も意図しないものとなります。そのため、除算演算子を使う場合には右オペランドの値が0になるケースには注意が必要です。
118+
{{book.console}}
119+
```js
120+
console.log(10 / 0); // => Infinity
121+
```
127122

128123
### 剰余演算子(`%`) {#modulus-operator}
129124

0 commit comments

Comments
 (0)