Gabriella Iofe: Giovannis Pizzeria. pizza-project#157
Gabriella Iofe: Giovannis Pizzeria. pizza-project#157gabster94 wants to merge 7 commits intoTechnigo:mainfrom
Conversation
…e. I also stored the input in a variable
…here the meal size is determined.
…zeria in the html
JoyceKuode
left a comment
There was a problem hiding this comment.
Big kudos to you on finishing this up with the time constraints you had. I hope my comments were helpful, and feel free to reach out if you have any questions. Overall, great job on pushing forward and getting this done.
| const name = prompt('What is your name?') | ||
| // Step 1c An alert confirmin the clients name | ||
| alert(`Ciao ${name.toUpperCase()}, Let's get started with your order!`) | ||
|
|
There was a problem hiding this comment.
Ah, nice touch to have my name in all caps 😀
| alert('You have selected a salad!') | ||
| } else { | ||
| alert('Invalid choice. Please use a number between 1 and 3') | ||
| } |
There was a problem hiding this comment.
Just for fun, I tried entering an invalid choice, and it had me go ahead and move on to the next question anyway. There are a couple ways to make this more logical: For example, I used a while loop to force the user to enter a valid number or else I would continuously prompt the user to enter 1 2 or 3. Another option is to use switch statements where the default case (anything other than options 1, 2, or 3) can alert an invalid choice and you can use location.reload() which should reload the page to start over.
| // Your code goes here | ||
| // Prompt where client is asked about their age to determine meal size | ||
| let age = prompt(`${name.toUpperCase()}, to ensure you get full by your meal we would like to know your age. Please, type in your age and click 'OK'`) | ||
|
|
There was a problem hiding this comment.
This didn't do anything when I entered my age (but weirdly, it worked when I tried with the number 2, then I got a child sized confirmation). I think it may be the same issue I had when I did my project, which is I had to cast the age variable to be a number in order to do things with the comparison operator, and then it worked for me. I think whenever you declare a variable, it defaults to be a string. So maybe try after you state let age = prompt ... then add this:
age = Number(age)
and that should convert the string type to a number type and then the following if statements should work.
| Step 1 and 2 felt pretty straight forward and simple, while step 3 got me into a position of thiking and scrathicng my head. After looking though different options of solving the problem I started trying out. I tried different approaches in CodePen until I was satisfied and copy/pasted it into VScode. The hardest part was figuring out how I initally wanted it to look, and how to make the code work, but when I finally uderstood it, the rest felt simple. | ||
|
|
||
| If I would have more time on my hands, I ould have worked more woth understanding everything, there are still many things that I don't understand. I wouls also make the code loop when incorrect answers were given, until the right one is entered. | ||
|
|
There was a problem hiding this comment.
I really enjoyed reading about your process in the README as I found it to be quite interesting and relatable, but there are some typos which made it a little distracting.
JennieDalgren
left a comment
There was a problem hiding this comment.
Great job with this project!
You have a little extra g in your code, causing some errors with your age check
if (age > 12) {g
age = 'Adult sized, 120kr'
Fix that, and you should be good to go!
💪
|
Hey, I removed the random G. Hope it's good now :) |
Netlify link
https://pizzeriagivovanni.netlify.app/