Skip to content

Gabriella Iofe: Giovannis Pizzeria. pizza-project#157

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

Gabriella Iofe: Giovannis Pizzeria. pizza-project#157
gabster94 wants to merge 7 commits intoTechnigo:mainfrom
gabster94:main

Conversation

@gabster94
Copy link

Copy link

@JoyceKuode JoyceKuode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'`)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@JennieDalgren JennieDalgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!
💪

@gabster94
Copy link
Author

Hey, I removed the random G. Hope it's good now :)

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.

3 participants