-
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
Ampers - Sara S #31
base: master
Are you sure you want to change the base?
Ampers - Sara S #31
Conversation
JS ScrabbleWhat We're Looking For
|
let letters = word.toUpperCase().split(``); | ||
|
||
if (word.match(/^[a-zA-Z]{1,7}$/) == null) { | ||
throw `How'd you get a non-letter tile, even?`; |
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.
:)
} | ||
|
||
hasWon() { | ||
if (this.totalScore() >= 100) { |
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 could also simply
return this.totalScore() >= 100;
|
||
|
||
test('returns false when score < 100', () => { | ||
const player = new Scrabble.Player('test player'); |
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.
It would be good to loop through until you reach 99, the edge case, and verify that hasWon()
is false
.
|
||
|
||
test('returns true when score > 100', () => { | ||
const player = new Scrabble.Player('test player'); |
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.
It would also be good to verify that 101 makes hasWon()
true
JS Scrabble
Congratulations! You're submitting your assignment!
Comprehension Questions