Merge pull request #2753 from vigu86/patch-1

Remove redundant word in Possible Mistakes section
This commit is contained in:
Ilya Kantor 2021-10-25 22:25:09 +03:00 committed by GitHub
commit 3c62eccbaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -160,7 +160,7 @@ button.onclick = sayThanks;
button.onclick = sayThanks();
```
If we add parentheses, then `sayThanks()` becomes 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.
If we add parentheses, then `sayThanks()` becomes 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.
...On the other hand, in the markup we do need the parentheses: