Bhaj's word checker

Heeeeeeeelp! Plzzzzzzzzzzzz I’m going crazy bcoz of this puzzle what am i doing wrong

reply soon :sob:

Hey there. Let me help you.

You see this right.

function check(space, word) {
    if (word.length !== space.length) {
        return false;
        for (let zach = 0; zach < space.length; zach++) {
            if (space[zach] !== '-' && space[zach] !== word[zach]) {
                return false;
        }
    }
    return true;
};

Try changing it to:

function check(space, word) {
    if (space.length !== word.length) {
        return false;
    }
    for (let i = 0; i < space.length; i++) {
        if (space[i] !== '-' && space[i] && space[i] !== word[i]) {
            return false;
        }
    }
    return true;
};

Hope this helps!
:smiley: :smiley: :smiley: