In the 10th line of code below, the answer remains the same (& correct) whether i write itemCount or orderCount.
How it is possible?
Shouldn’t itemCount result in a error, because in the last line the console.log does not having anything called itemCount?
var orderCount = 0;
function takeOrder(topping, crustType) {
console.log('Order: ’ + crustType + ’ crust pizza topped with ’ + topping);
orderCount = (orderCount + 1);
}
takeOrder(‘bacon’,‘thin’);
takeOrder(‘pepperoni’,‘regular’);
takeOrder(‘pinapple’,‘whole grain’);
function getSubTotal(itemCount) {
return itemCount * 7.5;
}
console.log(getSubTotal(orderCount));