How to use safe arithmetic for large numbers beyond safe integer in JavaScript

1 Answer

0 votes
function multiplyBigInt(x, y) {
    return BigInt(x) * BigInt(y);
}

console.log(multiplyBigInt(989719925834672991, 3)); 

 
 
/*
run:
 
2969159777504019072n
 
*/

 



answered May 18, 2025 by avibootz
...