isNaN might not be the best choice here, but I think it's probably ok