Skip to content

Commit

Permalink
fix: prevent confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
honzajavorek committed Apr 24, 2024
1 parent db81b41 commit 318025f
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ It will produce a result like this, but it **won't be** the Sony subwoofer.

![Query a selector with JavaScript](./images/devtools-collection-query.png)

> In the screenshot, there is a missing semicolon `;` at the end of the line. In JavaScript, semicolons are optional, so it makes no difference.
When we look more closely by hovering over the result in the Console, we find that instead of the Sony subwoofer, we found a JBL Flip speaker. Why? Because earlier we explained that `document.querySelector('.product-item')` finds the **first element** with the `product-item` class, and the JBL speaker is the first product in the list.

![Hover over a query result](./images/devtools-collection-query-hover.png)
Expand Down

0 comments on commit 318025f

Please sign in to comment.