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
alert(`Cool, the script ${script.src} is loaded`);
101
101
alert( _ ); // function declared in the loaded script
102
102
});
103
103
*/!*
@@ -229,7 +229,7 @@ In the code above:
229
229
2. We load `2.js`, then if there's no error.
230
230
3. We load `3.js`, then if there's no error -- do something else `(*)`.
231
231
232
-
As calls become more nested, the code becomes deeper and increasingly more difficult to manage, especially if we have a real code instead of `...`, that may include more loops, conditional statements and so on.
232
+
As calls become more nested, the code becomes deeper and increasingly more difficult to manage, especially if we have real code instead of `...` that may include more loops, conditional statements and so on.
233
233
234
234
That's sometimes called "callback hell" or "pyramid of doom."
235
235
@@ -299,7 +299,7 @@ See? It does the same, and there's no deep nesting now because we made every act
299
299
300
300
It works, but the code looks like a torn apart spreadsheet. It's difficult to read, and you probably noticed that one needs to eye-jump between pieces while reading it. That's inconvenient, especially if the reader is not familiar with the code and doesn't know where to eye-jump.
301
301
302
-
Also, the functions named `step*` are all of single use, they are created only to avoid the "pyramid of doom." No one is going to reuse them outside of the action chain. So there's a bit of a namespace cluttering here.
302
+
Also, the functions named `step*` are all of single use, they are created only to avoid the "pyramid of doom." No one is going to reuse them outside of the action chain. So there's a bit of namespace cluttering here.
0 commit comments