Functions Exercise 6 Return ||


It gave me an error message like this: Did you put the getTotal() function call inside of a console.log statement? PLESAE I REALLY NEED SOMEONES HELP AS SOON AS POSSIBLE. I WANT TO LEARN JAVASCRIPT AS SOON AS POSSIBLE SO I WILL NOT LOSE MY JOB... SOME ONE SHOULD HELP ME PLEASE... THANK YOU..

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

takeOrder('bacon','sandwich pizza');
takeOrder('bacon','meat pizza');
takeOrder('bacon','chicken pizza');
takeOrder('bacon','pork pizza');
function getTax(){
  return getSubTotal((orderCount)*0.06);
function getTotal(){
    return getSubTotal(orderCount) + getTax();}
console.log (getTotal());


Simple Answer: There is a space between log and the open parenthesis. That space is an error.

Other points: Your code is not the most readable and could be better organized. Readability is a huge part of being a programmer. It makes it easier to debug code or read it to understand it. Also, grouping functions together make them easier to find when you have a lot of code. See below example for details (it's your code with whitespace used to make it easier to read).

var orderCount = 0;

function takeOrder(toppings, crustType) {	
	console.log('Order: ' + crustType + ' topped with ' + toppings);

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

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

function getTotal() {
    return getSubTotal(orderCount) + getTax();

takeOrder('bacon', 'sandwich pizza');
takeOrder('bacon', 'meat pizza');
takeOrder('bacon', 'chicken pizza');
takeOrder('bacon','pork pizza');
console.log(getTotal());  // <-- Removed the space between log and the opening parenthesis.


Thank you so much. My code is working now. i still have another question for you. please where i am doing my internship now , they require me to learn ''Underscope.js'' as fast as possible. so i went to google and checked about it but everything seems so strange to me. please can you tell me what to do and how to learn this "Underscope.js". Sorry for bothering you.Thanks.


I've never heard of underscope.js. Are you sure it's not underscore.js


Sorry it was a typographical error. I am talking of Underscore.js.


I haven't programmed with underscore.js. If I were going to start, I would treat it like any other things I want to learn. Look online for some resources on how to get started and code example until I feel comfortable enough to try to create a simple program and add more features to it as I learn more.

Here's another resource I thought was a quick read and useful:

I also recommend checkout YouTube videos.

I hope this helps.


Thanks so much for your help. I already have accessed the website and the tutorial was really nice. At least now I know what Underscore.js is all about. I still need more in depth tutorial for underscore.js. I will do some searching on Google for other tutorials on this topic. Please if you still know of any other material or website which will help me to have more in depth understanding of this course I will really appreciate you letting me know. Anyway, thanks for your assistance. I really appreciate it.


@pyninja79800 The word underscore.js is a link to underscore documentation. Be sure to check this out too.


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