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


#1

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));


#2

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}`);

#3

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));


#4

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


#5

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));


#6

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));


#7

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;
};

#8

thanks…


#9

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