the isNaN condition should be the first to be tested