-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the order.js wiki!
It all started with pizza.js, the original file of order.js, on Codecademy. The person orders a pizza, which is already called in the code. The subtotal and total is found. The pizzaOrder()
function had parameters of size and topping. Each function had at least one console.log statement and the mathematical operation functions (getTax()
, getSubTotal()
, getTotal()
) returned a value so it can be called in the next function.
This soon grew into hot dogs, drinks, and fries. These were all to accomplish one task - an order - so I wrapped it in a parent groupOrder()
function. The groupOrder took an orders
parameter, an array of calling the order functions inside this function. Since the functions were nested, a group of commands that defined the functions as object properties of the parent function groupOrder
(because functions are objects) was needed. It was similar to the current one below.
groupOrder.pizzaOrder = pizzaOrder;
groupOrder.hotDogOrder = hotDogOrder;
groupOrder.friesOrder = friesOrder;
groupOrder.drinkOrder = addDrink;