# global_unavailable

> A module uses a global that disko-js does not have, such as Math or Date.

A module uses a global that disko-js does not have, such as Math or Date.

| | |
| --- | --- |
| Kind | Build or validation problem |
| Reported by | Archive and source validation |
| `disko` exit code | 1 (problems) |

A module uses a global that disko-js, the language disko games run in, does
not have. Games run the same on every computer, so disko-js leaves out what
would differ between them:

- `Math`: import the functions from [`disko:math`](/reference/math) instead.
- `Date` and `performance`: count time in ticks, from the `tick` event.
- `eval` and `Function`: disko-js never runs code made from text.
- `WeakRef` and `FinalizationRegistry`, `SharedArrayBuffer` and `Atomics`.
- Anything from browsers or Node.js, such as `console`, `setTimeout` or
  `document`.

## Wrong

```ts title="src/rules.ts"
const half = Math.floor(score / 2);
```

## Right

```ts title="src/rules.ts"
import { floor } from "disko:math";

const half = floor(score / 2);
```

## See also

- [Randomness & determinism](/games/randomness)
- [`stdlib_module_unknown`](/errors/stdlib_module_unknown)
