Skip to content

Commit

Permalink
Grains approach fix (#2287)
Browse files Browse the repository at this point in the history
* Correct to throw new Error

* Update snippet.txt

* Update content.md
  • Loading branch information
bobahop authored Oct 2, 2023
1 parent 3eda450 commit ec14468
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
```javascript
export function square(num) {
if (num < 1 || num > 64) {
throw 'square must be between 1 and 64';
throw new Error('square must be between 1 and 64');
}
return 1n << (BigInt(num) - 1n);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export function square(num) {
if (num < 1 || num > 64) {
throw "square must be between 1 and 64";
throw new Error('square must be between 1 and 64');
}
return 1n << (BigInt(num) - 1n);
}
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/grains/.approaches/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ For more information, check the [exponentiation approach][approach-exponentiatio
```javascript
export function square(num) {
if (num < 1 || num > 64) {
throw 'square must be between 1 and 64';
throw new Error('square must be between 1 and 64');
}
return 1n << (BigInt(num) - 1n);
}
Expand Down

0 comments on commit ec14468

Please sign in to comment.