If you want to return the base to the exponent's power, you could either use Math.pow(base, exponent)
or base ** exponent
.
This works for small numbers like 20 ** 5
, but if you want slightly bigger numbers, 20 ** 200
for example, you only get the first few numbers. Thus, in this case 1.6069380442589902e+260
. And if you want even bigger numbers, such as 20 ** 20000
, JavaScript returns Infinity
.
I want to return the exact number instead of only the first 17s. I know this is possible in Python; but how can I do it in JavaScript?