-
Notifications
You must be signed in to change notification settings - Fork 103
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
raina cambpell PR #85
base: main
Are you sure you want to change the base?
Conversation
Z: 1, | ||
}; | ||
|
||
let lettersArr = Object.keys(letterPool); |
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.
Remember we want to reserve the use of let
for variables to look to re-assign later on and const
for variables that we want to protect from re-assignment.
export const drawLetters = () => { | ||
// Implement this method for wave 1 | ||
let hand = []; | ||
let letterPoolCopy = [...lettersPool]; |
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 see you made a copy of lettersPool
but it doesn't seemed like it was mutated anywhere. So my question is, do you think we could have just used lettersPool
in place of letterPoolCopy
?
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.
Actually, disregard this comment! Upon further inspection I can see where you mutated it!
let input_letter_count = {}; | ||
for (let i = 0; i < input.length; i++) { | ||
let letter = input[i]; | ||
input_letter_count[letter] = (input_letter_count[letter] || 0) + 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.
Oh wow, I'm stealing this! 😭
score += 8; | ||
} | ||
|
||
return score; |
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.
⭐️
let highestScore = 0; | ||
let winningWord = ''; |
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.
If we know we want to return these variables in object form, could just initialize said object here?
} | ||
} | ||
|
||
return { word: winningWord, score: highestScore }; |
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.
Very easy to follow!
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.
Nice job, Raina! As you probably noticed, I didn't give too much feedback due to the scope of the project (Translating your python code to Javascript code). I tried to just point out any glaring issues, if any. With that being said, if you want to discuss anything in greater detail, feel free to reach out to me!
No description provided.