Right. Using the spec is a poor way of knowing how JS engines actually implement the functionality. If they can get functionally equivalent results that perform better by using slightly different steps, they will.
Based on the tests, it looks like browsers do NOT do type conversions: j = 0 if (uninitialisedLocalBoolean != false) : 401 j = 0 if (uninitialisedLocalBoolean !== false) : 398 Those are using “== true” and “=== true” respectively. I’m going to keep repeating myself until the performance argument dies down. Performance is NOT a reason to do initialization or strict comparison. Behavior and likelihood of bugs are both valid arguments, but performance is simply not an argument here. The question that I think Alex is looking at, is whether the compiler can handle boolean comparisons without initialization so it would do the right thing without a performance hit. I’d be interested in hearing his findings. Thanks, Harbs > On Jun 29, 2017, at 1:07 PM, Justin Mclean <jus...@classsoftware.com> wrote: > > HI, > >> There are tests for both, and you DON’T get type conversions unless it’s >> required. Browsers are smarter than that. > > See [1] and follow the path if x in undefined and y is a boolean and true. > > Compare this with [2] > > Thanks, > Justin > > 1. https://es5.github.io/#x11.9.3 <https://es5.github.io/#x11.9.3> > 2. https://es5.github.io/#x11.9.6 <https://es5.github.io/#x11.9.6>