Conversation
- 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
HIPPIEKICK
left a comment
There was a problem hiding this comment.
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
| <script src="./script.js"></script> | ||
|
|
||
| <!-- Second script with switch method --> | ||
| <script src="./switch.js"></script> |
There was a problem hiding this comment.
You should probably just have one of these linked at once 👀
jacquelinekellyhunt
left a comment
There was a problem hiding this comment.
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`) | ||
| } | ||
|
|
There was a problem hiding this comment.
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:));
}
There was a problem hiding this comment.
Thank you, Kelly! That's a good tipp!
https://pizza-pasta-salad.netlify.app/