isNaN(undefined) is actually true, same as isNaN(NaN). From: Yishay Weiss<mailto:[email protected]> Sent: Thursday, March 26, 2020 6:27 PM To: [email protected]<mailto:[email protected]> Subject: RE: Numbers not initialized to NaN
Ok, I’ll investigate why it’s undefined. > isNaN(percentHeight) is thus evaluated I meant !isNaN Thanks. From: Josh Tynjala<mailto:[email protected]> Sent: Thursday, March 26, 2020 6:23 PM To: Apache Royale Development<mailto:[email protected]> Subject: Re: Numbers not initialized to NaN Numbers should be initialized to NaN, unless you've added -js-default-initializers=false to your compiler options. -- Josh Tynjala Bowler Hat LLC <https://bowlerhat.dev> On Thu, Mar 26, 2020 at 9:17 AM Yishay Weiss <[email protected]> wrote: > I think this might have come up in one of my previous posts so my > apologies if I’m repeating a question. In Flex.as we have the following > code: > > if (!isNaN(percentHeight) > && child.includeInLayout) > { > height = > Math.max(child.minHeight, > > Math.min(child.maxHeight, > > ((percentHeight >= 100) ? h : h * percentHeight / 100))); > } > > percentHeight, which is a Number, seems to be initialized to undefined. > isNaN(percentHeight) is thus evaluated to true which results in the wrong > height being set. > > Should I change the code to check for undefined instead of NaN, or should > the compiler initialized to NaN? >
