Skip to content

Commit 2bff9f0

Browse files
committed
feat: explain dollar sign variable names
1 parent b3186f8 commit 2bff9f0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sources/academy/webscraping/scraping_basics_javascript2/06_locating_elements.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ Sony XBR-950G BRAVIA 4K HDR Ultra HD TV |
108108

109109
There's still some room for improvement, but it's already much better!
110110

111+
:::info Dollar sign variable names
112+
113+
In jQuery and Cheerio, the core idea is a collection that wraps selected objects, usually HTML elements. To tell these wrapped selections apart from plain arrays, strings or other objects, it's common to start variable names with a dollar sign. This is just a naming convention to improve readability. The dollar sign has no special meaning and works like any other character in a variable name.
114+
115+
:::
116+
111117
## Precisely locating price
112118

113119
In the output we can see that the price isn't located precisely. For each product, our scraper also prints the text `Sale price`. Let's look at the HTML structure again. Each bit containing the price looks like this:

0 commit comments

Comments
 (0)