I am trying to use setTimeout with a bigint to avoid exceeding the 32 bit integer limit(which did happened in my code) while incrmenting the timeout timer.
setTimeout(console.log, 500n, "I waited 500 ms");
However I got this error thrown:
Uncaught TypeError: Cannot convert a BigInt value to a number
I tried to do this:
setTimeout(console.log, Number(500n), "I waited 500 ms");
However I am not sure if the 500 will still be converted to a big integer.
Another thing I tried to do was to convert it using the ++
operator however it threw me the error:
Uncaught TypeError: Cannot convert a BigInt value to a number
let _500 = 500n
setTimeout(console.log, _500++, "I waited 500 ms");