Skip to content

Conversation

@erikamolsson
Copy link

Copy link
Contributor

@HIPPIEKICK HIPPIEKICK left a 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!

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"))
}
Copy link
Contributor

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? 👀

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