Return || : what i did wrong?


#1

what i did wrong? i’m at instructions 2

Functions Ex 6/10

“Syntax error”

https://www.codecademy.com/courses/learn-javascript-functions/lessons/functions/exercises/return-ii?action=lesson_resume&course_redirect=introduction-to-javascript

```

let orderCount = 0;

const takeOrder = (topping, crustType) => {
orderCount++;
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>

#2

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;

#3

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