I have a series of Javascript calculations that (only under IE) show Infinity depending on user choices.
How does one stop the word Infinity
appearing a
I like to use Lodash for a variety of defensive coding reasons as well as readability. ES6 Number.isFinite
is great and does not have issues with non-numeric values, but if ES6 isn't possible, you already have lodash, or want briefer code: _.isFinite
_.isFinite(Infinity); // false
_.isFinite(NaN); // false
_.isFinite(-Infinity); // false
_.isFinite(null); // false
_.isFinite(3); // true
_.isFinite('3'); // true