Open
Conversation
dogezen
reviewed
May 2, 2024
| function scrabble() { | ||
| // write code here | ||
| function checkIncorrect(letterArray) { | ||
| const allowedChars = [ |
Contributor
There was a problem hiding this comment.
better put this outside function since its const and read only:
SCABBLE_LETTERS or similar would be better name
| @@ -1,5 +1,150 @@ | |||
| function scrabble() { | |||
| // write code here | |||
| function checkIncorrect(letterArray) { | |||
Contributor
There was a problem hiding this comment.
checkIncorrect is bad name doesn't tell me what it is going to check for / what it is goign to return, pick a better name
| @@ -1,5 +1,150 @@ | |||
| function scrabble() { | |||
| // write code here | |||
| function checkIncorrect(letterArray) { | |||
Contributor
There was a problem hiding this comment.
this is usually called character array not letter array
| } | ||
| } | ||
|
|
||
| function specialCases(letterArray) { |
Contributor
There was a problem hiding this comment.
again, bad function name, special cases doesn't tell me what this function is meant to do
|
|
||
| for (let i = 0; i < letterArray.length; i++) { | ||
| let currentLetterScore = 0 | ||
| if (onePointers.includes(letterArray[i])) { |
Contributor
There was a problem hiding this comment.
this is quite a lot of code repetition, if you had represented the letters and scores as a dictionary, you could have done this in 3 lines of code:
const LETTER_SCORES = {
a: 1,
b: 2,
etc..
}
// score:
const score = LETTER_SCORES[letter]
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.