Skip to content

Conversation

@ziyuw131
Copy link

No description provided.

});

// filter by type
document.getElementById('all').addEventListener('click', () => {

Choose a reason for hiding this comment

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

A suggestion for cleaner code: consider selecting all the buttons as an array, and then using a for loop to set one generic click event function to it. You can determine which filter the button is by using the element's ID in the for loop. That way, you can add new filters without having to change any javascript.

@doradohunter
Copy link

Nice work!

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