-
Notifications
You must be signed in to change notification settings - Fork 44
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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; | ||
} |
There was a problem hiding this comment.
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; | ||
}; |
There was a problem hiding this comment.
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()); | ||
|
There was a problem hiding this comment.
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" | ||
|
There was a problem hiding this comment.
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.
@CheezItMan