Skip to content

Commit 4aa9f81

Browse files
authored
replace side-effect with side effect
1 parent 291b5c0 commit 4aa9f81

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed

1-js/02-first-steps/13-while-for/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ for (let i = 0; i < 10; i++) {
268268

269269
From a technical point of view, this is identical to the example above. Surely, we can just wrap the code in an `if` block instead of using `continue`.
270270

271-
But as a side-effect, this created one more level of nesting (the `alert` call inside the curly braces). If the code inside of `if` is longer than a few lines, that may decrease the overall readability.
271+
But as a side effect, this created one more level of nesting (the `alert` call inside the curly braces). If the code inside of `if` is longer than a few lines, that may decrease the overall readability.
272272
````
273273
274274
````warn header="No `break/continue` to the right side of '?'"

1-js/02-first-steps/14-switch/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ switch (a) {
139139
140140
Now both `3` and `5` show the same message.
141141
142-
The ability to "group" cases is a side-effect of how `switch/case` works without `break`. Here the execution of `case 3` starts from the line `(*)` and goes through `case 5`, because there's no `break`.
142+
The ability to "group" cases is a side effect of how `switch/case` works without `break`. Here the execution of `case 3` starts from the line `(*)` and goes through `case 5`, because there's no `break`.
143143
144144
## Type matters
145145

1-js/02-first-steps/15-function-basics/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ function name(parameters, delimited, by, comma) {
522522
523523
To make the code clean and easy to understand, it's recommended to use mainly local variables and parameters in the function, not outer variables.
524524
525-
It is always easier to understand a function which gets parameters, works with them and returns a result than a function which gets no parameters, but modifies outer variables as a side-effect.
525+
It is always easier to understand a function which gets parameters, works with them and returns a result than a function which gets no parameters, but modifies outer variables as a side effect.
526526
527527
Function naming:
528528

1-js/06-advanced-functions/08-settimeout-setinterval/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ setTimeout(function() {...}, 100);
232232
233233
For `setInterval` the function stays in memory until `clearInterval` is called.
234234
235-
There's a side-effect. A function references the outer lexical environment, so, while it lives, outer variables live too. They may take much more memory than the function itself. So when we don't need the scheduled function anymore, it's better to cancel it, even if it's very small.
235+
There's a side effect. A function references the outer lexical environment, so, while it lives, outer variables live too. They may take much more memory than the function itself. So when we don't need the scheduled function anymore, it's better to cancel it, even if it's very small.
236236
````
237237

238238
## Zero delay setTimeout

1-js/13-modules/01-modules-intro/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ In other words:
272272
- module scripts wait until the HTML document is fully ready (even if they are tiny and load faster than HTML), and then run.
273273
- relative order of scripts is maintained: scripts that go first in the document, execute first.
274274
275-
As a side-effect, module scripts always "see" the fully loaded HTML-page, including HTML elements below them.
275+
As a side effect, module scripts always "see" the fully loaded HTML-page, including HTML elements below them.
276276
277277
For instance:
278278

2-ui/3-event-details/1-mouse-events-basics/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Move the mouse over the input field to see `clientX/clientY` (the example is in
154154

155155
## Preventing selection on mousedown
156156

157-
Double mouse click has a side-effect that may be disturbing in some interfaces: it selects text.
157+
Double mouse click has a side effect that may be disturbing in some interfaces: it selects text.
158158

159159
For instance, double-clicking on the text below selects it in addition to our handler:
160160

2-ui/3-event-details/4-mouse-drag-and-drop/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ ball.style.left = pageX - ball.offsetWidth / 2 + 'px';
100100
ball.style.top = pageY - ball.offsetHeight / 2 + 'px';
101101
```
102102

103-
Not bad, but there's a side-effect. To initiate the drag'n'drop, we can `mousedown` anywhere on the ball. But if "take" it from its edge, then the ball suddenly "jumps" to become centered under the mouse pointer.
103+
Not bad, but there's a side effect. To initiate the drag'n'drop, we can `mousedown` anywhere on the ball. But if "take" it from its edge, then the ball suddenly "jumps" to become centered under the mouse pointer.
104104

105105
It would be better if we keep the initial shift of the element relative to the pointer.
106106

2-ui/3-event-details/7-keyboard-events/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ The `onkeydown` handler here uses `checkPhoneKey` to check for the key pressed.
149149

150150
As we know, the `false` value returned from the event handler, assigned using a DOM property or an attribute, such as above, prevents the default action, so nothing appears in the `<input>` for keys that don't pass the test. (The `true` value returned doesn't affect anything, only returning `false` matters)
151151

152-
Please note that special keys, such as `key:Backspace`, `key:Left`, `key:Right`, do not work in the input. That's a side-effect of the strict filter `checkPhoneKey`. These keys make it return `false`.
152+
Please note that special keys, such as `key:Backspace`, `key:Left`, `key:Right`, do not work in the input. That's a side effect of the strict filter `checkPhoneKey`. These keys make it return `false`.
153153

154154
Let's relax the filter a little bit by allowing arrow keys `key:Left`, `key:Right` and `key:Delete`, `key:Backspace`:
155155

3-frames-and-windows/06-clickjacking/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Depending on your browser, the `iframe` above is either empty or alerting you th
154154

155155
## Showing with disabled functionality
156156

157-
The `X-Frame-Options` header has a side-effect. Other sites won't be able to show our page in a frame, even if they have good reasons to do so.
157+
The `X-Frame-Options` header has a side effect. Other sites won't be able to show our page in a frame, even if they have good reasons to do so.
158158

159159
So there are other solutions... For instance, we can "cover" the page with a `<div>` with styles `height: 100%; width: 100%;`, so that it will intercept all clicks. That `<div>` is to be removed if `window == top` or if we figure out that we don't need the protection.
160160

4-binary/03-blob/article.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ For each URL generated by `URL.createObjectURL` the browser stores a URL -> `Blo
101101

102102
A generated URL (and hence the link with it) is only valid within the current document, while it's open. And it allows to reference the `Blob` in `<img>`, `<a>`, basically any other object that expects a URL.
103103

104-
There's a side-effect though. While there's a mapping for a `Blob`, the `Blob` itself resides in the memory. The browser can't free it.
104+
There's a side effect though. While there's a mapping for a `Blob`, the `Blob` itself resides in the memory. The browser can't free it.
105105

106106
The mapping is automatically cleared on document unload, so `Blob` objects are freed then. But if an app is long-living, then that doesn't happen soon.
107107

0 commit comments

Comments
 (0)