Skip to content

Conversation

@diarreola
Copy link

No description provided.


export const drawLetters = () => {
// Implement this method for wave 1
let letterPoolCopy = JSON.parse(JSON.stringify(letterPool));

Choose a reason for hiding this comment

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

One idea here could be using spread syntax, as an alternate to making a copy. Way to go on figuring out something that worked!

const letters = [];

const keys = Object.keys(letterPoolCopy);
while (letters.length < 10) {

Choose a reason for hiding this comment

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

This loops makes sense, and I don't think you really have to worry about it here, but when I see
while loops like this, I think about adding some other kind of guard condition- like limiting the
number of attempts, for example-- to catch a possible infinite loop if there weren't enough letters
to be picked.


for (let i = 0; i < input.length; i++) {
if (letterBankCopy.includes(input[i])) {
delete letterBankCopy[i];

Choose a reason for hiding this comment

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

nice use of delete

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