console.log(a === b) // true
console.log(1/a === 1/b) // false
That's perfect math you mean, of course -Infinity != Infinity, what did you expect?
I think you should rather think harder, learn math possibly, and your 'safety' problems with arrays are not problems at all, it's the opposite for other people