change from type of to isNaN

More compact code. Let me know if there is a downside/performance hit.