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

Completed Practice DOM/Fetch Challenges #13

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

cmhorsey
Copy link

Practiced accessing information from the dog API and using it to update the DOM. Also practiced listening for user events and updating the DOM in response.

Copy link

@stephenmckeon stephenmckeon left a comment

Choose a reason for hiding this comment

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

Great work!

Comment on lines +39 to +57
function sortBreeds() {
let select = document.getElementById('breed-dropdown')
select.addEventListener('change', () => {
dogList.innerText = ''
let letter = select.value

for(const dogBreed in dogObj) {
if(dogBreed[0] === letter) {
let li = document.createElement('li')
li.innerText = dogBreed
dogList.appendChild(li)
li.addEventListener('click', () => {
li.style.color = 'green'
})
}
}
})
}
} sortBreeds()

Choose a reason for hiding this comment

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

This is definitely a cool way of doing this, but to make it more readable you could make the dogObj globally available and extract this function. That would make the code more readable and easier to follow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants