Skip to content

Commit

Permalink
Update examples comments (#749)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmahdav authored Mar 27, 2024
1 parent a3f4268 commit 1e5660c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/features/iterator-helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ for (const post of posts.values().drop(10)) {
// Select the list of blog posts from a blog archive page.
const posts = document.querySelectorAll('li:not(header li)');

// Get list of tags of the blog posts and log them. Each post can have more than one tag.
// Get list of tags of the blog posts and log them. Each post can have more than
// one tag.
for (const tag of posts.values().flatMap((x) => x.querySelectorAll('.tag').values())) {
console.log(tag.textContent);
}
Expand Down Expand Up @@ -136,7 +137,8 @@ console.log(dates);
// Select the list of blog posts from a blog archive page.
const posts = document.querySelectorAll('li:not(header li)');

// Find out if text content (title) of any blog post includes the `Iteartors` keyword.
// Find out if text content (title) of any blog post includes the `Iteartors`
// keyword.
posts.values().some((x) => x.textContent.includes('Iterators'));
```

Expand Down Expand Up @@ -172,7 +174,8 @@ console.log(posts.values().find((x) => x.textContent.includes('V8')).textContent
// Select the list of blog posts from a blog archive page.
const posts = document.querySelectorAll('li:not(header li)');

// First create an iterator from the posts. Then, log the text content (title) of the recent blog post that includes the `V8` keyword.
// First create an iterator from the posts. Then, log the text content (title) of
// the recent blog post that includes the `V8` keyword.
console.log(Iterator.from(posts).find((x) => x.textContent.includes('V8')).textContent);
```

Expand Down

0 comments on commit 1e5660c

Please sign in to comment.