Apparently missing something in 6. return II (getTax Function)


#1


Link: 6. Return II


I'm receiving an error that reads:

expected [Function
expected [Function

I'm not really sure what I'm doing incorrectly here, it looks like it should work, and I've read through the topics on here. Any help would be appreciated. I've attached my code below.

var orderCount = 0;

var takeOrder = function(topping, crustType) {
  console.log('Order: ' + crustType + ' pizza topped with ' + topping);
  orderCount++;
  console.log(getSubtotal(orderCount));
};

var getSubtotal = function(itemCount) {
  return itemCount * 7.5;
};

var getTax = function() {
 return getSubtotal(orderCount) * 0.06;
};

takeOrder('pepperoni','thicc crust');
takeOrder('bacon','thicc crust');
takeOrder('pesto','thicc crust');


#2

Me too! I'm getting the same nonsense.

2.
Inside the getTax function's block, multiply the subtotal times 6% (0.06). Make sure to return the result of this operation.

It's this, I've put all kinds, including

function getTax() {
return getSubTotal * 0.06;
}

But nothing seems to be working, i get the same messages as you do, I can't code in JS I'm only just learning so I can't be sure, but it could be an error by codecademy? I can't work it out, so I can't progress through the rest of the course, it doesn't give me the option to get code either.


#3

I fixed mine using

function getTax() {
return getSubTotal(orderCount) * 0.06;

the reason you're having a problem is because you're using incorrect camelCase, it needs you to be exactly what it asks for, i.e. getSubTotal not getSubtotal as you've put

I think this lesson needs to be a little clearer, the whole functions seemed like it left a lot to guesswork, it's good that it makes you think for yourself but I just think if the syntax was more clearly explained it would be better


#4

Yep, this did it! Could have sworn "Subtotal" was an actual word and not two. Thanks for the help!


#5

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