回答編集履歴

2

「負の数」を「正の数」に変換しない

2018/06/19 18:44

投稿

think49
think49

スコア18164

test CHANGED
@@ -26,11 +26,15 @@
26
26
 
27
27
 
28
28
 
29
+ ビット演算子は内部的に **ToInt32** を使用していますが、「負の数」を「正の数」に変換しません(ToInt32 と動作が異なります)。
30
+
31
+
32
+
29
33
  ```JavaScript
30
34
 
31
- number | 0;
35
+ console.log(-1.372 | 0); // -1
32
36
 
33
- ~~number;
37
+ console.log(~~-1.372); // -1
34
38
 
35
39
  ```
36
40
 

1

12.12.3 Runtime Semantics: Evaluation

2018/06/19 18:44

投稿

think49
think49

スコア18164

test CHANGED
@@ -40,7 +40,7 @@
40
40
 
41
41
  - [12.12 Binary Bitwise Operators - ECMAScript® 2017 Language Specification](http://www.ecma-international.org/ecma-262/8.0/#sec-binary-bitwise-operators)
42
42
 
43
- - [14.8.2.2 Expression Rules - ECMAScript® 2017 Language Specification](http://www.ecma-international.org/ecma-262/8.0/#sec-expression-rules)
43
+ - [12.12.3 Runtime Semantics: Evaluation - ECMAScript® 2017 Language Specification](http://www.ecma-international.org/ecma-262/8.0/#sec-binary-bitwise-operators-runtime-semantics-evaluation)
44
44
 
45
45
 
46
46