It seems to me that the code
console.log(1 / 0)
should return NaN, but instead it returns Infinity. However this
Because that's how floating-point is defined (more generally than just Javascript). See for example:
Crudely speaking, you could think of 1/0 as the limit of 1/x as x tends to zero (from the right). And 0/0 has no reasonable interpretation at all, hence NaN.