You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/03-code-quality/04-ninja-code/article.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,7 @@ While choosing a name try to use the most abstract word. Like `obj`, `data`, `va
83
83
84
84
Give them a try. A young initiate may wonder -- are such names really useful for a ninja? Indeed, they are!
85
85
86
-
Sure, the variable name still means something. It says what's inside the variable: a string, a number or something else. But when an outsider tries to understand the code, he'll be surprised to see that there's actually no information at all! And will ultimately fail to alter your well-thought code.
86
+
Sure, the variable name still means something. It says what's inside the variable: a string, a number or something else. But when an outsider tries to understand the code, they'll be surprised to see that there's actually no information at all! And will ultimately fail to alter your well-thought code.
87
87
88
88
The value type is easy to find out by debugging. But what's the meaning of the variable? Which string/number does it store?
89
89
@@ -153,7 +153,7 @@ function ninjaFunction(elem) {
153
153
}
154
154
```
155
155
156
-
A fellow programmer who wants to work with `elem` in the second half of the function will be surprised... Only during the debugging, after examining the code they will find out that he's working with a clone!
156
+
A fellow programmer who wants to work with `elem` in the second half of the function will be surprised... Only during the debugging, after examining the code they will find out that they're working with a clone!
157
157
158
158
Seen in code regularly. Deadly effective even against an experienced ninja.
159
159
@@ -197,7 +197,7 @@ function render() {
197
197
198
198
A programmer who jumps inside the `render` will probably fail to notice that there's a local `user` shadowing the outer one.
199
199
200
-
Then he'll try to work with `user` assuming that it's the external variable, the result of `authenticateUser()`... The trap is sprung! Hello, debugger...
200
+
Then they'll try to work with `user` assuming that it's the external variable, the result of `authenticateUser()`... The trap is sprung! Hello, debugger...
0 commit comments