DEV Community

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

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 Author

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.