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: 2-ui/2-events/01-introduction-browser-events/article.md
+3-3
Original file line number
Diff line number
Diff line change
@@ -160,9 +160,9 @@ button.onclick = sayThanks;
160
160
button.onclick=sayThanks();
161
161
```
162
162
163
-
If we add brackets, then `sayThanks()` -- will be the *result* of the function execution, so `onclick` in the last code becomes `undefined` (the function returns nothing). That won't work.
163
+
If we add parentheses, `sayThanks()` -- is a function call. So the last line actually takes the *result* of the function execution, that is `undefined` (as the function returns nothing), and assigns it to `onclick`. That doesn't work.
@@ -351,7 +351,7 @@ Some properties of `event` object:
351
351
: Event type, here it's `"click"`.
352
352
353
353
`event.currentTarget`
354
-
: Element that handled the event. That's exactly the same as `this`, unless you bind `this` to something else, and then `event.currentTarget` becomes useful.
354
+
: Element that handled the event. That's exactly the same as `this`, unless the handler is an arrow function, or its `this` is bound to something else, then `event.currentTarget` becomes useful.
355
355
356
356
`event.clientX / event.clientY`
357
357
: Window-relative coordinates of the cursor, for mouse events.
0 commit comments