Open
Conversation
…statements for drink and then food. Adding event listeners to the send button. Removing 'Name' from the input field.
HIPPIEKICK
approved these changes
Sep 19, 2024
Contributor
HIPPIEKICK
left a comment
There was a problem hiding this comment.
Great job building this chatbot café! ☕
JavaScript
- I see you’ve added DOMContentLoaded to ensure that all DOM elements are available before interacting with them. Nice idea!
- Functions like showMessage, handleNameInput, handleDrinkChoice, and others are well-defined and break down the logic into smaller, manageable parts.
- Solid conditions and flow, but it would be nice to see some other input options for users (e.g. buttons), but great that you're validating the input and continue to prompt the user
- There is some repeated logic across the input handling functions (handleDrinkChoice, handleFoodChoice, handleDishChoice). Consider creating a more generic input validation function to simplify the code.
- Great idea clearing the input! You could create a helper function (e.g., clearInput()) to streamline this action.
Clean Code
- Be consistent with if you're using single or double quotes
Overall, good job! However I would love to see you go a bit more wild with input options another time 😉
| const input = nameInput.value; // Get input from user | ||
| nameInput.value = ""; // Clear input field | ||
|
|
||
| if (!isAskingForDrink && !isAskingForFood && !isChoosingDish) { |
Contributor
There was a problem hiding this comment.
Hehe, couldn't this be isAskingForName 👀
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://jonas-chatbot.netlify.app/