Open
Conversation
HIPPIEKICK
approved these changes
Sep 12, 2024
Contributor
HIPPIEKICK
left a comment
There was a problem hiding this comment.
Hey! Nice job on this project 🤖 🥳
JavaScript
- Your if-else statements effectively control the flow based on the user's food choice ✅
- It would be nice to see some input validation 👀 However, the project follows the requirements!
- Most of your variable names are clear, but some could be improved for better readability. For example: choosePizza, choosePasta, chooseSallad could be renamed to selectedPizza, selectedPasta, and selectedSalad to make it clearer that these represent the user's choice. And the yourAge variable could be renamed to userAge to align with the userName variable from earlier prompts.
Clean Code
- You're using let for variable declarations, which is good. However, for variables that don’t change (like the user's name), consider using const to signify that the value won’t be reassigned.
const name = prompt("What is your name?")
Now you might be thinking "But wait, the username does change!" - but it's actually already given a value that is the prompt, so it's not changing. So it can be a const 😄
- Indentation looks consistend ⭐
Think about these things going forward, and keep up the good work!
Comment on lines
+103
to
+113
| if (yourAge <= 12) { | ||
| alert( | ||
| `You want to order one kids sized portion of our ${chooseFoodSub}!` | ||
| ) | ||
| confirmOrder = parseInt(prompt("Do you want to confirm your order?\n1. Yes\n2. No")) | ||
| } else if (yourAge >= 13) { | ||
| alert( | ||
| `You want to order one adult sized portion of our ${chooseFoodSub}!` | ||
| ) | ||
| confirmOrder = parseInt(prompt("Do you want to confirm your order?\n1. Yes\n2. No")) | ||
| } |
Contributor
There was a problem hiding this comment.
What happens if you move the confirmOrder to come after the if-else? 👀
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.
Netlify link:
https://js-pizzeria-place.netlify.app/