-
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
Beylul Kbreab #25
base: master
Are you sure you want to change the base?
Beylul Kbreab #25
Conversation
this.word = word.split(""); | ||
var score = 0; | ||
if (this.word.length == 7) { | ||
score = 50; |
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 way you reassigned the base score based on the length
} | ||
} | ||
|
||
for (var i = 0; i < arrayOfWords.length; i++) { |
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 is a bit redundant since it is repeating almost all of the same logic in the loop above. Any ideas on how to consolidate?
} | ||
|
||
if(scoredWords.length > 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.
JS syntax is a bit weird, but we do expect the {
to be on the same line as the if
and the else
var totalScore = 0; | ||
for(var i = 0; i < this.plays.length; i++){ | ||
totalScore += this.scrabble.score(this.plays[i]); | ||
console.log(this.scrabble.score(this.plays[i])); |
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 is good for debugging but it results in duplicating the score logic multiple times. I'd recommend assigning this value to a variable and then printing it our for performance purposes.
Finished with the basic requirements of the project and tested it. I have commented out the tests.