Skip to content

Commit

Permalink
Fixed typo "does not initialization yet" =>"has not been initialized … (
Browse files Browse the repository at this point in the history
  • Loading branch information
MaryRichelle authored Nov 18, 2023
1 parent 037c242 commit 30e5096
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function updateName() {
Here we are selecting a button (line 1), then attaching an event listener to it (line 3) so that when the button is clicked, the `updateName()` code block (lines 5–8) is run. The `updateName()` code block (these types of reusable code blocks are called "functions") asks the user for a new name, and then inserts that name into the button text to update the display.

If you swapped the order of the first two lines of code, it would no longer work — instead, you'd get an error returned in the [browser developer console](/en-US/docs/Learn/Common_questions/Tools_and_setup/What_are_browser_developer_tools)`Uncaught ReferenceError: Cannot access 'button' before initialization`.
This means that the `button` object does not initialization yet, so we can't add an event listener to it.
This means that the `button` object has not been initialized yet, so we can't add an event listener to it.

> **Note:** This is a very common error — you need to be careful that the objects referenced in your code exist before you try to do stuff to them.
Expand Down

0 comments on commit 30e5096

Please sign in to comment.