Skip to content

Pizza project Emelie Kedert#137

Open
EmelieNyberg wants to merge 7 commits intoTechnigo:mainfrom
EmelieNyberg:main
Open

Pizza project Emelie Kedert#137
EmelieNyberg wants to merge 7 commits intoTechnigo:mainfrom
EmelieNyberg:main

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