---
# System prepended metadata

title: TypeScript Test

---

# TypeScript Test

Write a function with the following signature:

```typescript
function canJump(nums: number[]): boolean
```

Given an integer array `nums`, determine if the last element can be reached from the first element.

Each element in the array represents the maximum jump length at that position.

Return `true` if you can reach the last index, or `false` otherwise.

`nums` may have up to 65,536 elements.

## Criteria

- Correctness: Your code must produce the correct result, without syntax errors, when run in a TypeScript 4.x environment.
- Readability: Your code should be clean, easy to understand and well-formatted. Comments are expected for any non-obvious code and engineering decisions.
- Efficiency: Your code should complete in a reasonable amount of time consuming a reasonable amount of resources.

## Submission

Please provide a Zip archive containing a single `.ts` file with the `canJump` function.

## Examples

```typescript
canJump([2, 3, 1, 1, 4]) === true
// Jump 1 step from index 0 to 1, then 3 steps to the last index.

canJump([3, 2, 1, 0, 4]) === false
// You will always arrive at index 3 no matter what.
// Its maximum jump length is 0, which makes it impossible to reach
// the last index.
```

---
Copyright (c) 2022 Imperium Empires. All rights reserved.