Skip to content

Commit ed4f6a4

Browse files
committed
Light pass over chapter 8
1 parent 0046a7a commit ed4f6a4

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

08_error.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ canYouSpotTheProblem();
5454

5555
{{index "let keyword", [binding, global]}}
5656

57-
Normally, when you forget to put `let` in front of your binding, as with `counter` in the example, JavaScript quietly creates a global binding and uses that. In strict mode, an ((error)) is reported instead. This is very helpful. It should be noted, though, that this doesn't work when the binding in question already exists as a global binding. In that case, the loop will still quietly overwrite the value of the binding.
57+
Normally, when you forget to put `let` in front of your binding, as with `counter` in the example, JavaScript quietly creates a global binding and uses that. In strict mode, an ((error)) is reported instead. This is very helpful. It should be noted, though, that this doesn't work when the binding in question already exists somewhere in scope. In that case, the loop will still quietly overwrite the value of the binding.
5858

5959
{{index "this binding", "global object", undefined, "strict mode"}}
6060

@@ -315,7 +315,7 @@ The `throw` keyword is used to raise an exception. Catching one is done by wrapp
315315

316316
{{index debugging, "call stack", "Error type"}}
317317

318-
In this case, we used the `Error` ((constructor)) to create our exception value. This is a ((standard)) JavaScript constructor that creates an object with a `message` property. In most JavaScript environments, instances of this constructor also gather information about the call stack that existed when the exception was created, a so-called _((stack trace))_. This information is stored in the `stack` property and can be helpful when trying to debug a problem: it tells us the function where the problem occurred and which functions made the failing call.
318+
In this case, we used the `Error` ((constructor)) to create our exception value. This is a ((standard)) JavaScript constructor that creates an object with a `message` property. Instances of `Error` also gather information about the call stack that existed when the exception was created, a so-called _((stack trace))_. This information is stored in the `stack` property and can be helpful when trying to debug a problem: it tells us the function where the problem occurred and which functions made the failing call.
319319

320320
{{index "exception handling"}}
321321

@@ -613,12 +613,12 @@ function withBoxUnlocked(body) {
613613
// Your code here.
614614
}
615615
616-
withBoxUnlocked(function() {
616+
withBoxUnlocked(() => {
617617
box.content.push("gold piece");
618618
});
619619
620620
try {
621-
withBoxUnlocked(function() {
621+
withBoxUnlocked(() => {
622622
throw new Error("Pirates on the horizon! Abort!");
623623
});
624624
} catch (e) {

18_http.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ Notes: <select></select> <button>Add</button><br>
789789
setState({notes: state.notes, selected: list.value});
790790
});
791791
note.addEventListener("change", () => {
792-
let {selected} = state
792+
let {selected} = state;
793793
setState({
794794
notes: {...state.notes, [selected]: note.value},
795795
selected

code/solutions/08_2_the_locked_box.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ function withBoxUnlocked(body) {
2020
}
2121
}
2222

23-
withBoxUnlocked(function() {
23+
withBoxUnlocked(() => {
2424
box.content.push("gold piece");
2525
});
2626

2727
try {
28-
withBoxUnlocked(function() {
28+
withBoxUnlocked(() => {
2929
throw new Error("Pirates on the horizon! Abort!");
3030
});
3131
} catch (e) {

0 commit comments

Comments
 (0)