3 ms·
I would probably structure the problem like this: var ans = someCalculation(x,y); if (truthy(ans) && !isNaN(ans)) //do something else
by fogus 13y ago
I would probably structure the problem like this:
var ans = someCalculation(x,y);
if (truthy(ans) && !isNaN(ans))
//do something
else
//do something else
The point being I like to dispatch conditions on boolean results of certain properties of my results rather than the result directly. It helps me to keep my sanity.
Thanks for the kind words BTW. :-)