Regarding your updated code:
const limit = !options.limit || options.limit === NaN ? 0 : options.limit
- If
options.limitisfalsy, this will setlimit = 0. Else, it will useoptions.limit - The second condition is not required because
NaNis a falsy value. It is already covered in!options.limitcondition. - Also,
options.limit === NaNis never true, not even ifoptions.limitisNaN. You need to useisNaN()orNumber.isNaN()to check forNaN
Your current code is equivalent to:
const limit = options.limit || 0.
3
solved difference between variables in typescript