Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update examples comments #749

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Find out if text content (title) of any blog post includes the `Iteartors`
// Find out if text content (title) of any blog post includes the `Iterators`

// 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
Loading