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

REFACTOR: Event handler should be contained in a function. #48

Closed
Tracked by #6
JoeDravarol opened this issue Jun 2, 2022 · 0 comments · Fixed by #60
Closed
Tracked by #6

REFACTOR: Event handler should be contained in a function. #48

JoeDravarol opened this issue Jun 2, 2022 · 0 comments · Fixed by #60
Assignees
Labels
enhancement New feature or request frontend help wanted Extra attention is needed

Comments

@JoeDravarol
Copy link
Collaborator

JoeDravarol commented Jun 2, 2022

The code below should be refactor into its own function so that we can call it on game start or game reset.

// this function toggles the pokemon card on click
let cards = document.querySelectorAll('.card');

cards.forEach(card => {
    card.addEventListener('click', ()=>{
        if(!(card.classList.contains('visible'))){
            card.className = 'card visible'
        }else{
            card.classList = 'card'
        }
    })
})
@JoeDravarol JoeDravarol mentioned this issue Jun 2, 2022
13 tasks
@JoeDravarol JoeDravarol added enhancement New feature or request help wanted Extra attention is needed frontend labels Jun 3, 2022
@Dex-theDev Dex-theDev self-assigned this Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants