nehel - 8 months ago 54

jQuery Question

I'm trying to get like first 7-8 numbers after digit on a number that is

`Infinity`

I.E.

`console.log((4^3)/(3^3));`

`Infinity`

`2.370370370...`

`2.370370370e+-60`

I tried to make it with

`result.toExponential(8);`

Answer

In javascript, exponentiation is made by the `Math.pow`

function. There is no inline operator like `^`

(as in python with `**`

).

You should instead compute

```
Math.pow(4, 3) / Math.pow(3, 3)
```

A part from that,

you were computing `(4 XOR 3) / (3 XOR 3)`

, which evaluates to 7 / 0, which is an Infinity.