Oops, try again. Hmm, it looks like your orangeCost() function doesn't return 25 when the cost of an orange is 5


#1

var orangeCost = function(price){
    console.log("Cost to buy an orange today is " + price);
      cost = price*5
    console.log("Cost to buy 5 oranges is " + cost);
  
}

orangeCost(5);

#2

where did i go wrong?


#3

You can make it more advance just by adding one more parameter in your function like this.

var oranges = function(price, num_oranges){
   Cost = console.log("cost of one orange" + price);
   Many_oranges = console.log("cost of " + num_oranges + " is " + price * num_oranges);
};

#4

Sorry about the format I can't do it on phone.


#5

It seems to be over the top for the exercise which just expects an output of 25 for an input of 5. So although the explaining strings are a good idea to pass this one just console.log the calculate cost variable.


#6

i did.
The same error is there.
Oops, try again. Hmm, it looks like your orangeCost() function doesn’t return 25 when the cost of an orange is 5


#7

Without your code it's almost impossible to say what the error is only that your output is most likely not 25.


#8

You are getting error because of you extra text inside the console.log try to just console.log(cost);


#9

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

Should do the trick. Keep it simple


#10

I've had that same error, my solution was made through:

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


#11

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

};

orangeCost(5);


#12

Thank You so much. Making life easier with man. Love You!!!!!!!


#13

it is right when it return 25....only 25


#14

Simply the best:

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

orangeCost(5);


#15

esto esta muy mal solo ay que poner la variable orangeCost=function(price) {
orangeCost(5)
console.log("cost of one orange" * price);
}
y ya esta solo es eso mas nada


#16

I had a similar problem. And the solution is to just print out the result without any text before it. In other words the console.log(); method just needs a variable inside and no text in quotes ("")