Skip to content

Conversation

@Willowtea08
Copy link

No description provided.

const photosPerLoad = 6;

console.log('hello');
function renderPhotos(filterType = 'all', limit = true) {

Choose a reason for hiding this comment

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

Love the use of default values for the parameters!

Comment on lines +81 to +99
document.getElementById('all').addEventListener('click', () => {
currentIndex = 0;
renderPhotos('all');
});

document.getElementById('nature').addEventListener('click', () => {
currentIndex = 0;
renderPhotos('nature');
});

document.getElementById('city').addEventListener('click', () => {
currentIndex = 0;
renderPhotos('city');
});

document.getElementById('animals').addEventListener('click', () => {
currentIndex = 0;
renderPhotos('animals');
});

Choose a reason for hiding this comment

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

To clean up your code, a suggestion would be to select all the buttons in one array, and then use a for loop to create a generic click event function for them all.

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