Leaves - Dominique #37
Conversation
JS AdagramsWhat We're Looking For
|
|
|
||
| drawLetters() { | ||
| // Implement this method for wave 1 | ||
| const rawTiles = { |
There was a problem hiding this comment.
Style wise - I recommend putting the object outside of the drawLetters() function (but inside the module).
|
|
||
|
|
||
| scoreWord(word) { | ||
| const scoreChart = { |
There was a problem hiding this comment.
Style wise - I recommend putting the object scoreChart outside of the scoreWod() function (but inside the module).
There was a problem hiding this comment.
Style note: You should create this object the same way you did for rawTiles:
const scoreChart = { A: 1, B: 3 ... }
| } | ||
| } | ||
|
|
||
| input.split('').forEach(checkForLetter); |
There was a problem hiding this comment.
Consider whether there's a different type of for loop that you could use that would allow you to break out of the loop as soon as you encounter false.
|
|
||
| const letterPool = []; | ||
|
|
||
| for(const key in rawTiles) { |
There was a problem hiding this comment.
I really like that you store the letter frequencies and then build the pool - this is much easier to read than a giant array full of 9 'A's, 2 'B's, etc.
|
|
||
| let i = 0; | ||
|
|
||
| while ( i <= 9) { |
There was a problem hiding this comment.
It looks like you could get the same letter twice because there's nothing keeping the random number from being repeated. Consider how you could address this.
JS Adagrams
Congratulations! You're submitting your assignment!
Comprehension Questions