-
Notifications
You must be signed in to change notification settings - Fork 175
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
project-3-pizza #138
base: main
Are you sure you want to change the base?
project-3-pizza #138
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.
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!
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")) | ||
} |
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.
What happens if you move the confirmOrder to come after the if-else? 👀
Netlify link:
https://js-pizzeria-place.netlify.app/