Skip to content
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

Amethyst Megan G. #146

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Amethyst Megan G. #146

wants to merge 11 commits into from

Conversation

scrambledmegs
Copy link

No description provided.

const lettersDrawnForHand = [];

while (lettersDrawnForHand.length < 10) {
let randomLetter = generateRandomLetter();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, when you defined generateRandomLetter, you make a call of createLetteList in it to create your list of letters from your LETTER_POOL. With this being said, every iteration of your while loop will make a new list of letters even though we don't really need a new list (it will look the same every time). I would suggest pulling it out of this function and calling createLetterList somewhere above the while loop in this function.

export const usesAvailableLetters = (input, lettersInHand) => {
// Implement this method for wave 2
const letterHandCopy = JSON.parse(JSON.stringify(lettersInHand));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are most likely aware of this now, but just in case you can make a copy array with the spread syntax like so [...lettersInHand].

score += 8;
}

return score;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐️

Comment on lines +133 to +134
let highestScore = 0;
let highestScoringWord = '';

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?

highestScoringWord = word;
}
else if (score === highestScore) {
if(highestScoringWord.length != 10 && (word.length === 10 || word.length < highestScoringWord.length)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the compound if statement very easy to follow!

return {
'score': highestScore,
'word': highestScoringWord
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job, Megs! 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants