What is the best way to realize high precision arithmetic calculations in JavaScript?

I’m doing an algorithm that checks if a number is prime for college, but I came across a connotation and calculation problem where I need to consider large numbers.

One of them was solved with the support of BigInt(), however in arithmetic calculations from a certain number of decimal places it ends up losing precision and consequently returning false true.

For example, multiplying 2 numbers ending in 1,3,7,9 always results in a number ending in 1,3,7,9, but from 3**34 onwards the calculations start to lose precision.

Is there any efficient way to solve this problem in JavaScript?