DEV Community

Discussion on: Some Things About JSON That You May Have Missed

Collapse
 
aumayeung profile image
John Au-Yeung

Thanks. That's a good catch.

Collapse
 
stephenmirving profile image
Stephen Irving

You should actually be using Number.isNan() over the global isNaN function which will give somewhat unexpected results in comparison to the newer method on the Number object. You should also use !Number.isFinite() instead of checking equality with Infinity.

Thread Thread
 
aumayeung profile image
John Au-Yeung

Thanks. That's also a good tip.

I think equality is still good as long as we use triple equals.

Thread Thread
 
stephenmirving profile image
Stephen Irving

Yes, you can still write it that way.