Just to add an "edge" case for the comparison.
In case you are converting bigint
to number
type you should use parseInt()
or even Number()
, because unary plus like +1n
would throw an error:
Uncaught TypeError: Cannot convert a BigInt value to a number