Skip to content

Commit ee4486c

Browse files
authored
Update primitives.md
1 parent cb2659b commit ee4486c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

challenges/primitives.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,15 +819,17 @@ myTag`Note: ${person} is a member of following communities: ${membership}`;
819819
820820
```js
821821
try {
822-
callAPI(); // It will throw an Error
822+
// Below statement will throw an Error
823+
callAPI();
823824
} catch (error) {
824-
throw new Error(error); // ReferenceError: callAPI is not defined
825+
// Create a new error and throw
826+
throw new Error(error); // ReferenceError: callAPI is not defined
825827
} finally {
826-
console.log("I will execute no matter what happened in try or catch");
828+
console.log('I will execute no matter what happened in try or catch');
827829
}
828830
```
829-
###### Notes
830831
832+
###### Notes
831833
- `try` can be chained with `catch` block or `finally` block
832834
- `try..catch` only works synchronously and for runtime errors
833835

0 commit comments

Comments
 (0)