Is there anything wrong because it says that didn't define orangeCost


#1

var orangeCost = function (price){console.log("what is the price")};
orangeCost = 5; console.log(orangeCost*5)


#2

var orangeCost=function(price)
{console.log(price*5);
}
orangeCost(5)

orangeCost is function you defined and you just could to recall it, for example orangeCost(5).
In that function you want to know how much cost 5 oranges and that is why console.log(price*5), so your function print price of 5 oranges. I you have questions, just ask.

P.S. Instead of console.log you can use return, you will get the same result.


#3

Good morning everyone. I am having the same problem here: it keeps telling me "you didn't define orangecost".
This is my code so far:
var orangecost=function(price)
{
console.log(price*5);
};
orangecost(5);

Could anyone tell me about it...what is wrong?...
Thanks in advance


#4

I think you should write "orangeCost" instead of "orangecost". Good luck.


#5

I'm having the same problem. Here is my code:

var orangeCost = function(price) {
console.log(price * 5);
};

OrangeCost(5)

It's saying that I didn't define orangeCost. Some people on this forum have corrected others with this code, which happens to be mine, but it's still not working. I know some people have mentioned creating another variable within the function as var val = price * 5 instead, but should this be necessary?


#6

Ohhh.... haha, yeah the O in OrangeCost was capitalized. Silly me. Be careful with your debugging kids.


#7

you put number in the function() not price. it should look like.
var orangeCost = function(number) {
return(number * 5)
}