On the page https://exercism.org/tracks/javascript/exercises/collatz-conjecture
In JavaScript, this can be done using the throw statement.
throw new Error('Only positive numbers are allowed');
test expect
.toThrow(new Error(‘Only positive integers are allowed’));
The proposed edit is within the track-specific instructions append so @SleeplessByte and @Cool-Katt as the JavaScript track maintainers can take it from here.
The line in question is
# Instructions append
## Implementation
If `n` is not a positive integer, stop the program from being executed further and return an error message.
In JavaScript, this can be done using the `throw` statement.
```javascript
throw new Error('Only positive numbers are allowed');
```
1 Like
I’ll take a PR for it, if you’ve got one @resu-xuniL