-
Notifications
You must be signed in to change notification settings - Fork 41
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
<pipes><Roxanne Agerone><js scrabble> #37
base: master
Are you sure you want to change the base?
Conversation
JS ScrabbleWhat We're Looking For
|
throw `This word is too long. Are you sure you aren't cheating?`; | ||
} else if (wordArray.length === 0){ | ||
throw 'You have to choose a word.'; | ||
} else{} |
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 don't need this final empty else{}
clause, you can just close the last else if
.
let point = letter_points[letter.toUpperCase()]; | ||
// try { | ||
if(point === undefined) { | ||
throw 'not found'; |
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.
Remember that the messages you throw will probably be seen by the user. 'not found'
might not give them enough context to figure out what went wrong - something like `invalid letter ${ letter }`
.
|
||
if (wordScore > highestScore || (highestScore === wordScore && word.length < highestScoringWord.length && highestScoringWord.length != 7) || (highestScore === wordScore && word.length === 7)){ | ||
highestScore = wordScore; | ||
highestScoringWord = 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.
This if logic is really long! Could you break it up into multiple lines? Something like
if (wordScore > highestScore ||
(highestScore === wordScore && word.length < highestScoringWord.length && highestScoringWord.length != 7) ||
(highestScore === wordScore && word.length === 7)) {
would be easier to read.
JS Scrabble
Congratulations! You're submitting your assignment!
Comprehension Questions