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 project Emelie Kedert #137

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

Conversation

EmelieNyberg
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.

Great work on this project! 🙌

JavaScript

  • Good job using both if-else and switch statements for conrtroling the flow based on user input ⭐
  • You've included some basic input validation to handle unexpected inputs, such as falling back to "no food" when an invalid input is provided. This is good, but you can improve it by stopping the script early if the user enters an invalid input, rather than letting it continue. For example:
  if (foodChoice !== "1" && foodChoice !== "2" && foodChoice !== "3") {
      alert("Invalid choice. Please refresh and start again.");
      return; // Exits the function if the choice is invalid
  }
  • You're using let to declare variables, which is good practice. But, it would be better to declare your variables at the start of the function or script for better readability and to follow clean coding practices. So, what you could do is to move all global variables to the top of your file
  • I like that you've added a feature to differentiate between child and adult portions. You might want to parse the age input as an integer to avoid unexpected behavior if a non-numeric value is entered:
let userAge = parseInt(prompt("Is this food for a child or an adult? Please type your age:"));

Clean Code

  • Indentation looks consistent ⭐
  • Most of your variable names are descriptive, good job! Some could be improved for clarity, e.g. subType could maybe be called selectedDish or something to make it even clearer what the variable represents.

Keep up the good work, and think about these things going forward 🥳

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