Stuck on Functions 6/7?


#1

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-javascript/lessons/functions/exercises/return-ii?action=lesson_resume

<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
I’m super stuck here. I’ve tried revisiting this exercise this morning, and I’m still not getting it.

I can get the basic code down up to this point.

```

function takeOrder(topping, crustType) {
console.log('Order: ’ + crustType ’ pizza topped with ’ + topping
}

takeOrder(‘pineapple’, ‘thinCrust’);
takeOrder(‘olives’, ‘pita bread’);
takeOrder(‘apple’, ‘fig leaf’);

<do not remove the three backticks above>

Now, I'm super confused with what to do with 

getSubTotal - where do I put this function??
getTax - where do I put this one?
return - what am I supposed to return in these functions?

#2

Back up in the course and start over with Functions lesson, i.e. back to 1. Introduction to Functions. Throughout the lesson you are building those functions as well as a global variable to hold the count. By the time you get to lesson 6, all of that structure is in place.


#3

I’ve tried this - I’m on my third run through right now and still very confused.

What need to go in the parenthesis of getSubTotal and why?


#4

You need to go back to the first lesson and then redo them in order.

In 2. Functions, you start building the takeOrder() function.

In 3 and 4, you are adding parameters to explore how you pass information to a function.

In 5. return, you create a global variable orderCount, build getSubTotal() function, and more.

In 6, you create 2 new functions: getTax() and getTotal().

In the code you have shown above, you are missing all of these. That’s why I recommend that you start the Functions lesson over again. Read the instructions carefully as you progress.


#5

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