Return || : what i did wrong?


what i did wrong? i’m at instructions 2

Functions Ex 6/10

“Syntax error”


let orderCount = 0;

const takeOrder = (topping, crustType) => {
console.log('Order: ’ + crustType + ’ pizza topped with ’ + topping);

takeOrder(‘mushroom’, ‘thin crust’);
takeOrder(‘spinach’, ‘whole wheat’);
takeOrder(‘pepperoni’, ‘brooklyn style’);

const getSubTotal = (orderCount) => {return itemCount * 7.5;};

const getTax = (orderCount) => {return getSubTotal(orderCount)+*0.06}

Replace this line with your code.
sorry for my english i’m italian i dont understand all

<do not remove the three backticks above>


ES6 lets us simplify pure functions by removing parens (only when there is exactly one parameter) and return keyword (implicit return) and braces when there are not multiple lines of logic.

const getSubTotal = itemCount => itemCount * 7.5;

Note the parameter is itemCount, not orderCount for this function. That’s what makes it a pure function… No iteraction with outside objects and predictible return values. The same thing in will always give the same thing out.

The second line is where the syntax error is… +*.

We can simplify that function, as well, but it will not be a pure function since it interacts with the orderCount global variable.

const getTax = orderCount => getSubTotal(orderCount) * 0.06;


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