Open
Conversation
nancy-harris
left a comment
There was a problem hiding this comment.
Excellent job! There are some comments below on places to make the code cleaner/simpler. For commits, it would be great if the commit messages could be more descriptive. Instead of talking about which wave was completed, something like "Created drawLetters function" would be great. Great job!
| // Implement this method for wave 1 | ||
| }; | ||
|
|
||
| const letterPool = { |
There was a problem hiding this comment.
This can be declared outside of the function so that it doesn't have to be recreated each time the function is called.
Comment on lines
+36
to
+52
| let letterList = []; | ||
|
|
||
| for (let letter in letterPool){ | ||
| let freq = letterPool[letter]; | ||
| for (let i = 0 ; i < freq ; i++) { | ||
| letterList.push(letter); | ||
| } | ||
| } | ||
|
|
||
| let hand = []; | ||
| while (hand.length < 10){ | ||
| let index = Math.floor(Math.random()*letterList.length); | ||
| let letterDrawn = letterList[index]; | ||
| hand.push(letterDrawn); | ||
| letterList.splice(index, 1); | ||
| } | ||
| return hand; |
|
|
||
| } | ||
|
|
||
| export const usesAvailableLetters = (input, lettersInHand) => { |
| export const scoreWord = (word) => { | ||
| // Implement this method for wave 3 | ||
| }; | ||
| const pointValues = { |
There was a problem hiding this comment.
This can be declared outside of the function.
Comment on lines
+100
to
+111
| let total = 0; | ||
| let wordUpper = word.toUpperCase(); | ||
|
|
||
| if (6 < word.length && word.length < 11) { | ||
| total += 8 | ||
| } | ||
| for (let letter of wordUpper){ | ||
| let letPoint = pointValues[letter]; | ||
| total += letPoint; | ||
| } | ||
|
|
||
| return total; |
| return total; | ||
| } | ||
|
|
||
| export const highestScoreFrom = (words) => { |
Comment on lines
+123
to
+125
| expectScores({ | ||
|
|
||
| }) |
There was a problem hiding this comment.
Looks like this test was not completed. Make sure to complete all tests!
| const correct = { word: "XXXX", score: scoreWord("XXXX") }; | ||
|
|
||
| throw "Complete test by adding an assertion"; | ||
| expect(highestScoreFrom(words)).toEqual(correct); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.