Closure Compiler - can a ++> = 3 become ++ a> 3?

I admit that I asked a question about why the Closure Compiler doesn’t abbreviate a certain code that looks at first glance a few days ago, but this reason is not applicable in this case, and I'm not quite sure why it is shortened here.

What is my code:

var a = 0;
function b() {
    return a++ >= 3;
}

Now there is pre-increment and post-increment. The difference lies in the return value - a++returns a, and then increases it, ++afirst increases a, and then returns it.

What this means is that my code can be shortened to (without considering removing spaces):

var a = 0;
function b() {
    return ++a > 3;
}

However, the Closure compiler does not seem to modify (or recognize) this.

, : ++a > a++ >=?

+5
3

( 3).

, JavaScript 64- IEEE-754 , "" "" 2 ^ 53 ( , ).

Firefox 4:

a = 2e53
a++ >= 2e53 // true

a = 2e53
++a > 2e53 // false

, ?: -0

.

+7

, (3 ) [- 2 52 2 52]. (, ), .

, Closure , :

  • , ,
  • , , , ,
  • , .
+2

?

function b(a) {
    return a++ >= 3;
}

function b2(a) {
    return ++a > 3;
}

console.log(b(2) === b2(2))
console.log(b(3) === b2(3))
console.log(b(4) === b2(4))

true.

+1

All Articles