Skip to content

Conversation

@ciindii
Copy link

@ciindii ciindii commented Jan 23, 2023

No description provided.

export const drawLetters = () => {
// Implement this method for wave 1
const letters = [];
let letter_pool_copy = { ...letterPool };

Choose a reason for hiding this comment

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

nice use of spread syntax

const letters = [];
let letter_pool_copy = { ...letterPool };
let keys = Object.keys(letter_pool_copy);
while (letters.length < 10) {

Choose a reason for hiding this comment

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

Okay, this loop makes sense to me! I might like to see some sort of guard condition put in, in case of not being able to pick enough letters, so that it doesn't spin indefinitely if none are left available.

let letter = wordArray[i];
if (lettersInHandCopy.includes(letter)) {
// lettersInHandCopy.filter((item) => item !== letter);
lettersInHandCopy.splice(lettersInHandCopy.indexOf(letter), 1);

Choose a reason for hiding this comment

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

ah, a javascript 'remove' function ;) (referring to your project reflection comments.)

Good solution!

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