# 75. implement BigInt subtraction

JavaScriptAlgorithmIs this helpful ?

Share

medium - accepted / - tried

Luckily we already have built-in support of BigInt in JavaScript, at least in some browsers.

```
1000000000000000000000n - 999999999999999999999n
// 1n
```

Suppose BigInt cannot be used, can you implement a string subtraction function by yourself?

```
subtract('1000000000000000000000', '999999999999999999999')
// '1'
```

All input are valid **non-negative integer strings**, and the result is guaranteed to be non-negative.

*Don't use BigInt directly, it is not our goal here*