Is it possible somehow to return 0 instead of NaN
when parsing values in JavaScript?
In case of the empty string parseInt
returns NaN
.
Is it possible to do something like that in JavaScript to check for NaN
?
var value = parseInt(tbb) == NaN ? 0 : parseInt(tbb)
Or maybe there is another function or jQuery plugin which may do something similar?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…