No, it is not:
> var i=0;
> with({ get var2() { return ++i; } }) {
> var var1 = var2 || 0;
> }
> var1
1
> var i=0;
> with({ get var2() { return ++i; } }) {
> var var1 = var2 ? var2 : 0;
> }
> var1
2
As you can see, the second one is rated var2twice. However, this is the only difference, and it hardly matters for the "normal" variables.
Bergi source
share