i want to check if a number is a BigInt in a acceptable size if statement
i know there is the solution
function isBigInt(x) {
try {
return BigInt(x) === x; // dont use == because 7 == 7n but 7 !== 7n
} catch(error) {
return false; // conversion to BigInt failed, surely it is not a BigInt
}
}
but i wanted to implement the test directly in my if statement, not in my function
can someone help me with that?