Can't "Call" a function with console.log?


I am having a lot of trouble calling the function I am describing in the "5 orangeCost" exercise. It also says I am not defining orangeCost. PLEASE HELP. Been stuck for hours.





I think that I may have the whole code wrong...

Any tips on how to format from the beginning ??


Well just note that a function is written in this format:

var example = function(/*Parameter*/){ ... }

Then you call that function by giving the function a parameter like so:


Pay close attention to the instructions the lessons give you and see if you can figure stuff out from there :smiley:


I know the format but I think the language I am using to represent "calculating the 5 oranges" and the language I am using the log the result is Incorrect! Any more advice? On diction more so?


Can you show me your current code so I can see what exactly it is that you're struggling on?


var calculate = function (orangeCost) {
var calculate = function (orangeCost * 5 === price);


Hi @edenteferi

If it may help please see the code example below. There are a few errors with your code to start and also the reason you are getting the error on the unit lesson is probably because you have not used the name orangeCost for your variable. Please review the following code to compare against.

var orangeCost = function(costOfOrange)  //use term orangeCost here and declare it as a function
    console.log(costOfOrange *5); //use the argument passed in under the term costOfOrange to calculate on, and print it to console

orangeCost(5); //call the function here and pass in your value for the function to use


Wow, thank you SO much @mike_in_training

I think I just completely blanked on that format, I appreciate you explaining this SO much, thank you.


try multiplying 5 by price so it looks like this (price*5)