It seems to me that the code
console.log(1 / 0)
should return NaN
, but instead it returns Infinity
. However this code:
console.log(0 / 0)
does return NaN
. Can someone help me to understand the reasoning for this functionality? Not only does it seem to be inconsistent, it also seems to be wrong, in the case of x / 0
where x !== 0
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…