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

Project Pizzeria Fresco! #140

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

Conversation

Fannyhenriques
Copy link

@Fannyhenriques Fannyhenriques commented Sep 5, 2024

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

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 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.
Copy link
Contributor

Choose a reason for hiding this comment

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

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.
Copy link
Contributor

Choose a reason for hiding this comment

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

🤩

Copy link

@joheri1 joheri1 left a comment

Choose a reason for hiding this comment

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

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! 😊

alert(
`Welcome to our Javascript Pizzeria. Ready to Start? - Click 'OK' to begin.`
Copy link

Choose a reason for hiding this comment

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

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.`
Copy link

Choose a reason for hiding this comment

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

Nice with the emojis! 😃

Write: 2 - for Pasta 🍝
Write: 3 - for Salad 🥗`)

// convert the variabel "foodSelection" to be a number instead of a string
Copy link

Choose a reason for hiding this comment

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

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) {
Copy link

Choose a reason for hiding this comment

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

Nice error handling with the loop.

}

// If choice is salad -> select type of salad
if (foodType === "Salad") {
Copy link

Choose a reason for hiding this comment

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

Kudos for using the camelCase format throughout the whole code.

}
//message with the subtype that has been chosen
alert(`Yum! You've selected ${subType}! Excellent choice! Click 'OK' to start placing your order.`)


// Step 4 - Age
Copy link

Choose a reason for hiding this comment

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

Smart to use the two options adult or child instead of age (integer). It made the response better, and the code cleaner.

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