Console.log (getTotal()); -- error


#1

This is the question:
4. On the last line of the program, call the getTotal function inside of a console.log statement to view the result.

This is my answer:
25 console.log (getTotal());

This is the result returned when I run the command:
Order: thin crust pizza topped with bacon
Order: think base pizza topped with chicken mayo
Order: no crust pizza topped with pineapple
22.5
23.85

I get the following error:
Did you put the getTotal() function call inside of a console.log statement?

The the getTotal function caqll is inside console log and a result is returned. Is this wrong or a bug?

Thanks


#2

Is there supposed to be a 25 before the console.log?

Could you also please copy and paste your full code?


#3

I think your code is fine, try to refresh page. If it still doesn't work, please post your full code and link to the lesson.


#4

Hi, no, there is no 25 infrom of console.log (It was just a blonde way to show "line 25"
Please find full code below;

var orderCount = 0;

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

function getSubTotal (itemCount) {
return itemCount * 7.5;
}

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

function getTotal () {
return getSubTotal(orderCount) + getTax ();
}
takeOrder (' thin crust ', ' bacon');
takeOrder (' think base ', ' chicken mayo');
takeOrder (' no crust ' ,' pineapple');

console.log (getSubTotal(orderCount));

console.log (getTotal());


#5

Link to lesson;

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


#6

Yeah your code is fine. If you are using chrome try a different browser.


#7

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