Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions courses/foundation/intro-to-javascript/week1/session-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ const pizzaPriceDiscounted = pizzaprice - 10;
const users = ["peter", "Johnny", "Børge"];

const lastUser = users[3];
console.log(lastUser);
```

### Pizza project
Expand All @@ -227,23 +228,24 @@ const lastUser = users[3];
3. Also inside the folder create a new JavaScript file called "pizza.js"
4. Remember to Include the pizza.js script in the html file
5. Write a log statement, so you know that your javascript code is running:

`console.log("I love pizza");`

6. Create a variable to store the name of your favourite pizza
7. Create a variable to store the price of the pizza
8. Now log a statement to the console that will show the chef the entire pizza order in a language they understand, e.g. like this:

`New pizza order: <name of pizza>. The price of the pizza is: <price of pizza>`

#### Part 2

Now we will modify the program so that you can order multiple pizzas and also decide if the pizzas should be family size
Now we will modify the program so you can order multiple pizzas and decide whether the order is takeaway.

1. Create a new variable to store the amount of pizzas you would like to order
2. Create a new variable to store whether or not the order is for takeaway
3. Now write a formula to calculate the total price of your pizza order, and save it in a variable called totalPrice
4. Modify the log statement for the chef so it includes whether or not the order is for takeaway, and now show the total price of the order:

2. Create a new variable to store whether or not you would to order a family size pizza.

3. Now write a formula to calculate the total price of your pizza order, and save it in a variable called totalPrice (if the pizza is family size the prize of the pizza is doubled.

4. Modify the log statement for the chef so it includes whether or not the pizza is family size, and now show the total price of the order
`New pizza order: <amount of pizzas> <family or not?> <name of pizza>. Total cost for the order is: <total price>`
`New pizza order (takeaway: <takeaway or not?>): <amount of pizzas> <name of pizza>. Total cost for the order is: <total price>`

5. Try to change the price of the pizza and if the pizza should be family size, and then check if the total price is calculated correctly.
5. Try to change the price of the pizza and then check if the total price is calculated correctly