-
Notifications
You must be signed in to change notification settings - Fork 175
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
Estefanny's PR pizzabot #148
base: main
Are you sure you want to change the base?
Conversation
…ile loop. Added step 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on tackling this project! 🎉
JavaScript
- Nice usage of the while loop and good control flow 👍
- You defined a helpful error message errMsg for incorrect input, which is great for user experience
- While using + to concatenate strings works, it's generally cleaner to use template literals (backticks) in modern JavaScript. It will make your code easier to read:
alert(`Hi ${customerName}! What are you craving today?`)
- Currently, the while loop relies on an empty string check to keep prompting the user. It might be cleaner and safer to check if the input is one of the valid options directly.
Overall, really good job with this project - these are just some things to consider going forward ⭐
while (isNaN(age) == true || age < 1 || 100 < age) { | ||
age = prompt("How old are you?", "Please type your age here") | ||
if (isNaN(age) == true || age < 1 || 100 < age) { | ||
alert("Please enter a valid age.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha what if I'm really old 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried your webpage and it worked really good! I even tried to fail som of the questions, but that was inpossible since you had made really cool loops for that😍
Great job with the project!
let foodType = "" | ||
while (foodType == "") { | ||
if (foodChoice == "Pizza") { | ||
choice = prompt("Please enter a number: \n 1 - Napolitana \n 2 - Margherita \n 3 - Sicilian", "Please type you number of choice here") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cool if you also included something in the message like, "What type of pizza would you like?" Please enter a number.....🤩
while (foodChoice == "") { | ||
let choice = prompt("Please enter a number: \n 1 - Pizza \n 2 - Pasta \n 3 - Salad", "Please type you number of choice here") | ||
if (choice == 1) { | ||
foodChoice = "Pizza" | ||
} else if (choice == 2) { | ||
foodChoice = "Pasta" | ||
} else if (choice == 3) { | ||
foodChoice = "Salad" | ||
} else { | ||
alert(errMsg) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The loop was really cool! Nice that you get back to the same question again if you type the wrong answer!
Netlify link
https://precious-zabaione-04568c.netlify.app/