I think I did what it asks but I can't get it to equal anything else but zero

let orderCount = 0;
const takeOrder = (topping, crustType, orderCount) => { console.log('Order: ’ + crustType);
console.log('topped with ’ + topping);
orderCount===(orderCount + 1)};
const getSubTotal = (itemCount) =>
{return(itemCount *7.5)};

takeOrder(‘mushrooms’,‘thin crust’);
takeOrder(‘olives’,‘thick crust’);
takeOrder(‘spinach’,‘regular’);
console.log(getSubTotal(orderCount));

The operator used there is a comparison operator, not an assignment.

orderCount = orderCount + 1;

or in simplified form using a compound assignment operator,

orderCount += 1;

or even,

orderCount++;

The lesson checker is likely expecting a single console.log() statement, meaning concatenation of the strings.

console.log('Order: ’ + crustType + 'topped with ’ + topping);

Check to make sure you use the exact string values given in the instructions.

This will also work…

console.log(`Order: ${crustType} topped with ${topping}`);
2 Likes

It still gives me zero

et orderCount = 0;
const takeOrder = (topping, crustType, orderCount) => { console.log('Order: ’ + crustType);
console.log('topped with ’ + topping);
orderCount +=1};
const getSubTotal = (itemCount) =>
{return(itemCount *7.5)};

takeOrder(‘mushrooms’,‘thin crust’);
takeOrder(‘olives’,‘thick crust’);
takeOrder(‘spinach’,‘regular’);
console.log(getSubTotal(orderCount));

1 Like

I accidentally didn’t copy the ‘L’ in let (first word). There is an ‘L’ in the real program.

1 Like

let orderCount = 0;
const takeOrder = (topping, crustType, orderCount) => { console.log('Order: ’ + crustType);
console.log('topped with ’ + topping);
orderCount +=1;};
const getSubTotal = (itemCount) =>
{return(itemCount *7.5)};

takeOrder(‘mushrooms’,‘thin crust’);
takeOrder(‘olives’,‘thick crust’);
takeOrder(‘spinach’,‘regular’);
console.log(getSubTotal(orderCount));

1 Like

the latest …

let orderCount = 0;
const takeOrder = (topping, crustType, orderCount) => { console.log('Order: ’ + crustType + 'topped with ’ + topping);
orderCount +=1;};
const getSubTotal = (itemCount) =>
{return(itemCount *7.5)};

takeOrder(‘mushrooms’,‘thin crust’);
takeOrder(‘olives’,‘thick crust’);
takeOrder(‘spinach’,‘regular’);
console.log(getSubTotal(orderCount));

1 Like

Since whitespace is free, it pays to use it liberally so your code is easier to read and identify structure. Note also that we do not pass orderCount to the function. It is a global that the function has access to, already.

const takeOrder = (topping, crustType) => {
  console.log('Order: ' + crustType + 'topped with ' + topping);
  orderCount +=1;
};
1 Like

thanks…

2 Likes

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