-
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
JavaScript pizzeria :) #155
base: main
Are you sure you want to change the base?
Conversation
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.
Good job on getting this project together! You've done a great job with your code, covering all the necessary steps for interaction, conditional statements, and user input.
JavaScript
- You’ve used if-else statements correctly to handle various user inputs. However, there’s a slight issue with comparing guestAge. In JavaScript, you should be comparing numbers, not strings. I think you meant to do this with the line
const age = Number(guestAge);
but then you're doing the comparison based on guestAge anyway. On this same topic, I think clearer variable names could make this clearer - e.g. instead of guestAge and age, they could be named userInputAge and ageConvertedToNumber or something "overly descriptive". Feel free to name variables as descriptive as you want. - Consider adding even more validation, such as toLowerCase()
- Use template literals instead of plus sign to improve clean code and readability:
alert(`Hi ${guestName}!`)
Changes requested
- Add quotation marks to pepperoni
- Correct age validation
With this said, you managed really well with the project - just need these tiny corrections 😄
code/script.js
Outdated
selectedFoodType = 'Margherita' | ||
} else if (pizzaType === '2') { | ||
alert('You have chosen Pepperoni!') | ||
selectedFoodType = Pepperoni |
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.
Pepperoni is not defined - should be quotation marks around it
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.
Hi, @JennieDalgren made the requested changes to the JS file.
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.
👍
Netlify link
https://66de0156d116e596d11ff09e--coruscating-basbousa-190b83.netlify.app/