-
Notifications
You must be signed in to change notification settings - Fork 357
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
Wk 3 - Project Guess Who - Submitted #328
base: main
Are you sure you want to change the base?
Conversation
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.
Overall, I found your code very organised and nicely commended! Well done! I also like the colour you chose.
One thing I think you need to fix is your timer!!! It seems to work the first time I play, and when I click the second time it goes too fast I think.
// We also need a variable that stores the actual value of the question we've selected. | ||
// const value = | ||
const category = questions.options[questions.selectedIndex].parentNode.label //stores selected category after find out button | ||
const value = questions.options[questions.selectedIndex].value //stores selected value after find out button |
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.
This is a good choice!! I was really stupid, and I chose to go with text instead of value... It went with a lot of obstacles.
} | ||
return (currentQuestion) //do I need this?? |
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.
You don't need to return here, because you assigned to currentQuestion which has been declared at the beginning of your code. As far as I know, when you need to return to something is when you need to get something through a function.
1, A function returns undefined, if you don't return.
2, Arrow function might return without writing "return", if it is a just single line of code.
const calcAge=birthYear=> 2023-birthYear
calcAge(1999)
-----> 24
The function above doesn't need to return, but it returns automatically.
This function needs to be returned, as it produces something and doesn't assign it to a variable.
So if you want to use function declaration, you need to write return.
I hope it makes sense to you...
charactersInPlay = charactersInPlay.filter((person) => !person[category].includes(value)) | ||
*/ | ||
|
||
// Invoke a function to redraw the board with the remaining people. | ||
} |
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 found your code is quite organized and easy to read! And I noticed one small thing that you can even make it better. You can call just generateBored function once at the end of filterFunction, so don't need to place it many times:))
if (confirmGuess) { | ||
checkMyGuess(personToConfirm); | ||
} else if (!confirmGuess) { | ||
return; |
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.
Here you don't need to return it, if you want. You can just write one statement and no else if.
No description provided.