Lesson 6


#1

My code:
var orangeCost = function(price)
{
var val = price * 5;
console.log("You have just paid" + " " + val + " " + "dollars for oranges.");
}
orangeCost(5);

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

Help?


#2

you wrote

console.log("You have just paid" + " " + val + " " + "dollars for oranges.");

but the error message says 'your orangeCost() function doesn't return 25 when the cost of an orange is '5.'
you have to return a value in your function(i.e. return val)

then you call the function like this

console.log(orangeCost(5));