sei-ec-remote / project-1-issues

Open new issues here
1 stars 2 forks source link

Del button is not working #248

Closed FartuunH closed 9 months ago

FartuunH commented 9 months ago

What's the problem you're trying to solve?

del button is not deleting its adding space

Post any code you think might be relevant (one fenced block per file)

 function updateGuessed(letter) {

        const currentArr = getWordArr();

        if(currentArr && currentArr.length < 5){
            currentArr.push(letter)

            const SpaceEl = document.getElementById(String(space));
            space = space + 1;

            SpaceEl.textContent = letter;

    }

If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?

its adding space

What is your best guess as to the source of the problem?

i don't know

What things have you already tried to solve the problem?

created delete function `` function deleteLetter() { const currentArr = getWordArr();

       if (currentArr && currentArr.length > 0) {
           const lastLetter = currentArr.pop();
           const spaceEl = document.getElementById(String(space - 1));
           space = space - 1;
           spaceEl.textContent = '';
        }
    }

``

Paste a link to your repository here

https://github.com/FartuunH/Wordle

timmshinbone commented 9 months ago

console log the space el inside the delete function, specifically the spaceEl grabbed by this line:

const spaceEl = document.getElementById(String(space - 1));

share the results here

FartuunH commented 9 months ago

Thank you Tim, it worked