|
javascriptJavascript guidanceSo I primarily come from a graphic design background, which is one of the things that's attracted me to QC so much. I'm quickly coming to the realization that I need to flex my analytical side a bit more, and teach myself something a bit complex. So I decided to start with Javascript because it would have the most use and immediate utility for my projects. I need someone assistance in finding tutorials and the like for someone that doesn't think like a programmer. If that makes any sense. Any ideas?
Check if number is NaN in javascript patchG'Day all I was just wondering if anyone knows a clean way to check if a number is NaN. I have tried 4 ways and only one returns true, but its a bit messy. 1/ (This way doesn't work) var testNumber = NaN; if (testNumber == undefined) // This returns false Log("testNumber is NaN"); else Log("testNumber was not detected as NaN)"; 2/ (This way errors) var testNumber = NaN; if (isnan(testNumber)) // This errors as there is no isnan() method Log("testNumber is NaN"); else Log("testNumber was not detected as NaN)"; 3/ (This way doesn't work) var testNumber = NaN; if (testNumber == NaN) // returns false Log("testNumber is NaN"); else Log("testNumber was not detected as NaN)"; 4/ (This way works, but is not clean and makes me sad inside) var testNumber = NaN; var testNumber2 = testNumber || -9999; if (testNumber == -9999) // returns true, as wanted. Log("testNumber is NaN"); else Log("testNumber was not detected as NaN)"; Anyone have any ideas? Cheers Lango
QuartzBuilder 1.0 Alpha 1QuartzBuilder Alpha (please please please don't turn this into a drawn out feature request listing -- we're well aware of missing features, but lack the time to add them all for the initial release.)
|