-
Notifications
You must be signed in to change notification settings - Fork 42
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
Ana Lisa Sutherland - Octos C9- JS Scrabble #38
base: master
Are you sure you want to change the base?
Conversation
…r and lower case conditions
…ayer class and associated tests tomorrow morning
JS ScrabbleWhat We're Looking For
|
scoreBoard: { | ||
'A': 1, 'E': 1, 'I': 1, 'O': 1, 'U': 1, 'L': 1, 'N': 1, 'R': 1, 'S': 1, 'T': 1, | ||
'D': 2, 'G': 2, | ||
'B': 3, 'C': 3, 'M': 3, 'P': 3, |
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 like the use of a hash to store this info.
//throws if word is longer then 7 characters | ||
if (word.search(/[^a-zA-Z]+/) !== -1 || word.length === 0 || word.length > 7) { | ||
throw 'Invalid 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.
Instead of throwing a string, you should throw an instance of Error
. That gives you access to stack trace information. Something like this:
if (condition) {
throw new Error(`Invalid word ${word}`);
}
const tieBreak = function tieBreak(best_word, challenger_word) { | ||
console.log(`Best Word: ${best_word}`); | ||
console.log(`Challenger Word: ${challenger_word}`); | ||
if (best_word.length === 7) { |
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 use of a helper function to clarify this logic.
JS Scrabble
Congratulations! You're submitting your assignment!
Comprehension Questions
What was a challenge you faced in this assignment? |
I had some issues debugging and remembering the differences in functions and classes, creating and passing functions was something I kept mixing up. I then spent more time trying to decide how to proceed then I thin was necessary.
Do you have any recommendations on how we could improve this project for the next cohort? |
Maybe publically repost the instructor implementation w/tests from Ruby, that would have helped tremendously when I got stuck on test writing. It would have been at least good to see what to test again, and also would have unstuck me when I was building the highestScoreFrom function in Wave 1.