What is supposed to be the meaning of:
var a = b ? c : d ? e : f;
is it
var a = b ? c : (d ? e : f);
or
var a = (b ? c : d) ? e : f;
See also: forums.garmin.com/.../bug-nested-ternary-operator-returns-incorrect-value-in-sdk-8-0-0
What is supposed to be the meaning of:
var a = b ? c : d ? e : f;
is it
var a = b ? c : (d ? e : f);
or
var a = (b ? c : d) ? e : f;
See also: forums.garmin.com/.../bug-nested-ternary-operator-returns-incorrect-value-in-sdk-8-0-0
As discussed in the other two bug reports about this:
- var a = b ? c : (d ? e : f)
=> right-associativity for the ternary operator, which is the pre-8.0.0 behaviour and probably what most people expect. It's also what most C-style languages use, with PHP as a notable exception
- var a = (b ? c : d) ? e : f
=> left-associativity for the ternary operator, which is the 8.0.0 behaviour and probably not what most people want. It's obviously a breaking change (and likely a bug).