-
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
Jamila Octos C9 #42
base: master
Are you sure you want to change the base?
Jamila Octos C9 #42
Conversation
Wrote some tests that still have bugs so I did not push those. didnt get to write all of my tests. |
switch (true) { | ||
case /[ eaotinrslu ]/.test(letter): | ||
case /[ EAOTINRSLU]/.test(letter): | ||
wordScore += 1 |
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 indent the content within a case statement
for (let letter of characters) { | ||
switch (true) { | ||
case /[ eaotinrslu ]/.test(letter): | ||
case /[ EAOTINRSLU]/.test(letter): |
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 made the word lowercase at the start of this function so do you still need to be checking for both upper and lower cases here?
|
||
} | ||
|
||
if (arrayOfWords.length > 0) { |
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.
Is this needed with the conditionals above?
if (this.score(word) > this.score(highScoreWrd)) { | ||
highScoreWrd = word | ||
|
||
} else if (this.score(word) == this.score(highScoreWrd)) { |
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 are potentially scoring these words multiple times. You should store the scores in a variable so you aren't duplicating this logic.
return highScoreWrd | ||
|
||
} else if (word.length < highScoreWrd.length) { | ||
highScoreWrd = 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.
Watch out! You're missing semi-colons on the majority of your js expressions here
return false | ||
}else if (Scrabble.score(word)) { | ||
this.plays.push(word) | ||
let score = Scrabble.score(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.
Again, scoring the word multiple times rather than storing it in a variable
JS ScrabbleWhat We're Looking For
|
JS Scrabble
Congratulations! You're submitting your assignment!
Comprehension Questions