Just returns 0 to the console


#1

var orderCount = 0;
function takeOrder(topping, crustType,  orderCount = orderCount + 1)

{
  console.log("order: " + crustType + " pizza topped with " + topping);
}
function getSubTotal(itemCount){
  return itemCount * 7.5;
takeOrder('bacon', 'crispy');
takeOrder('chilli','thick');
takeOrder('Ham','puff');

}

console.log(getSubTotal(orderCount));
function getTax(){
  return getSubTotal(orderCount) *0.06;
}
function getTotal(){
  return getSubTotal(orderCount) + getTax();
}
console.log(getTotal());.

#2

Could you send the assignment to me :stuck_out_tongue:


#3

It is as below:
var orderCount = 0;
function takeOrder(topping, crustType, orderCount = orderCount + 1)

{
console.log("order: " + crustType + " pizza topped with " + topping);
}
function getSubTotal(itemCount){
return itemCount * 7.5;
takeOrder('bacon', 'crispy');
takeOrder('chilli','thick');
takeOrder('Ham','puff');

}

console.log(getSubTotal(orderCount));
function getTax(){
return getSubTotal(orderCount) *0.06;
}
function getTotal(){
return getSubTotal(orderCount) + getTax();
}
console.log(getTotal());.


#4

TakeOrder and its parameters in your function getSubTotal(itemCount){} can't be reached cause its after the return function
and in your function takeOrder() the parameter orderCount can be written like this orderCount++ means increment by 1.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.