Conversation
HIPPIEKICK
left a comment
There was a problem hiding this comment.
Great job with this project 🎊 Really solid validation and clean structure, kudos!
JavaScript
- Using the while loop effectively ensure valid user input, super nice!
- Well organized code and descriptive comments 👍
- You've done well by re-prompting the user for valid input, especially in the food and subtype selections.
- Your code correctly validates user inputs for the food type and subtype by ensuring that only valid options are accepted. However, it could be helpful to convert inputs to lowercase for consistency when handling userAge and confirmation, e.g.
if (userAge.toLowerCase() === "adult" || userAge.toLowerCase() === "child")
Clean Code
- console.logging a lot is great for development purposes, but shouldn't be left in the production code. Remember to remove all console.logs going forward (before handing in)
- Descriptive variable names ⭐
Keep up the good work! I'm impressed 🤩
|
|
||
| Properly handerling the Variables: Structuring the code to ensure variables were introduced at the correct time. | ||
|
|
||
| Initially, a lot of variables (like foodType or pizzaType) were embedded within conditional blocks (such as if statements), which led to scope issues. To fix this, I restructured the code so that these variables were declared in the right order. |
| If given more time, I would: | ||
|
|
||
| - Refactor the code: To clean it up further by breaking parts of the code into functions for better readability and maintainability. | ||
| - Extend Functionality: Allow more complex customizations, such as toppings for pizzas or dressings for salads. |
joheri1
left a comment
There was a problem hiding this comment.
Overall, your code is well-structured, and you've done a fantastic job keeping it interactive and user-friendly. The use of loops, conditional statements, and clear prompts makes the user experience smooth. You've kept the code clean with good practices, such as using camelCase.
Great work, and keep it up! 😊
| // Step 1 - Welcome and introduction | ||
| // Your code goes here | ||
| alert( | ||
| `Welcome to our Javascript Pizzeria. Ready to Start? - Click 'OK' to begin.` |
There was a problem hiding this comment.
It doesn’t seem to affect anything, but I noticed two alerts in one call.
| console.log("User's name is:", userName) | ||
|
|
||
| alert( | ||
| `Hi there, ${userName}! 😊 It's great to meet you. Click 'OK' to start placing your order.` |
| Write: 2 - for Pasta 🍝 | ||
| Write: 3 - for Salad 🥗`) | ||
|
|
||
| // convert the variabel "foodSelection" to be a number instead of a string |
There was a problem hiding this comment.
Good job converting the user input to a number. That made your conditional statement cleaner, and ensures that the comparison works as expected.
|
|
||
| // If choice is pasta -> select type of pasta | ||
| if (foodType === "Pasta") { | ||
| while (true) { |
| } | ||
|
|
||
| // If choice is salad -> select type of salad | ||
| if (foodType === "Salad") { |
There was a problem hiding this comment.
Kudos for using the camelCase format throughout the whole code.
| alert(`Yum! You've selected ${subType}! Excellent choice! Click 'OK' to start placing your order.`) | ||
|
|
||
|
|
||
| // Step 4 - Age |
There was a problem hiding this comment.
Smart to use the two options adult or child instead of age (integer). It made the response better, and the code cleaner.
Project: Pizzeria Fresco!
Pizzeria Fresco is ment to be; an interactive JavaScript-based bot that takes a user's order at a virtual pizzeria. It starts by greeting the user, asking for their name, and guiding them through choosing a dish from the menu. The bot also collects the user's age and provides an order confirmation.
The Problem
The primary challenges in this project were:
Properly handerling the Variables: Structuring the code to ensure variables were introduced at the correct time.
Initially, a lot of variables (like foodType or pizzaType) were embedded within conditional blocks (such as if statements), which led to scope issues. To fix this, I restructured the code so that these variables were declared in the right order.
Ensuring User Input Validation: The goal was to continuously prompt the user until they provided a valid input. This was achieved using a while (true) loop, which only breaks when the user selects a valid option. If an invalid option is selected, the loop will prompt the user again.
If given more time, I would:
Refactor the code: To clean it up further by breaking parts of the code into functions for better readability and maintainability.
Extend Functionality: Allow more complex customizations, such as toppings for pizzas or dressings for salads.
View it Live: Deployed Project: https://main--pizzeriafresco.netlify.app