Skip to content
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

pizza-pasta-salad #141

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

pizza-pasta-salad #141

wants to merge 12 commits into from

Conversation

gittebe
Copy link

@gittebe gittebe commented Sep 6, 2024

- added an alert welcoming the user;
- added a prompt to asked user to select one food option out of three;
- added an alert to confirm the selected food option;
- added an image for the background
- added another while method for the age
- added a new javascript file to the folder
- changed the order option to drinks
- added age
- added order confirmation
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.

Great job with this pizza bot Gitte 🍕

JavaScript

  • Well structured control flow! Nice to see that you tried out the switch approach as well
  • Nice that you're validating the input. The while loop will ensure proper answers from the user 👍
  • Your naming of variables is generally good! Maybe they would be even clearer if firstOrder was renamed to mealType and secondOrder to dishType? Just a thought :)
  • Don't forget to declare variables with const or let! And to put all global variables at the top of the file so that they're easier to find

Clean Code

  • Make sure to indent your code properly, e.g. the else and else if statements should go on the previous line:
if (something) {
  //
} else {
  //
}

Keep up the good work! ⭐

code/index.html Outdated
Comment on lines 18 to 21
<script src="./script.js"></script>

<!-- Second script with switch method -->
<script src="./switch.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably just have one of these linked at once 👀

Copy link

@jacquelinekellyhunt jacquelinekellyhunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, both in script.js and switch.js you have demonstrated a good understanding in building interactive user interfaces for ordering systems. I think you have been very consistent with good readability and clean structure which makes it easy for me as a stranger, to understand the code (although additional comments would have been amazing)! 😊
Also great use of While loops!

else if (age < 13) {
alert(`Thank you.You like to order a kid's ${secondOrder}. Click 'ok' to order`)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I found which maybe could have an improvement at this stage is that you could parse the age value and validate against potential edge cases (e.g., negative or unrealistic ages).

let age = parseInt(prompt(How old are you, ${name}?));
while (isNaN(age) || age < 0 || age > 120) {
alert(Please enter a valid age.);
age = parseInt(prompt(Enter your age:));
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Kelly! That's a good tipp!

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.

3 participants