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

Jessica's JS Scrabble #24

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Jessica's JS Scrabble #24

wants to merge 7 commits into from

Conversation

jchung722
Copy link

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Overall looks pretty good Jessica, not bad at all!

bestWord = word;
} else if (word.length > bestWord.length && word.length == 7) {
bestWord = word;
}

Choose a reason for hiding this comment

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

I think this series of if/else could be simplified. Think about it a little.

totalScore += Scrabble.score(word);
});
return totalScore;
};

Choose a reason for hiding this comment

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

Just FYI, the forEach function above is depreciated, but it will still work fine.

console.log(jess.hasWon());
console.log(jess.highestScoringWord());
// console.log(jess.highestWordScore());

Choose a reason for hiding this comment

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

Good work putting code to test things.

console.log(Scrabble.highestScoreFrom(["hello", "blah", "test", "elevens"])); //should return "elevens"
console.log(Scrabble.highestScoreFrom(["hi", "dig"])); //should return "hi"
console.log(Scrabble.highestScoreFrom(["lost", "tons"])); //should return "lost"
console.log(Scrabble.highestScoreFrom(["AEIOULD", "QZQZQJ"])); //should return "AEIOULD"

Choose a reason for hiding this comment

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

You should have a few more tests to test the different possibilities for highestScoreFrom.

Testing in all different orders with:
A 7-letter word
Multiple 7-letter words
Multiple 7-letter words with tied scores.
Word that tie in score
Words that tie in score and are the same length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants