6 D.R.Y Help please


#1

I've looked at some of the other posts but they're all a little different.

My code:

var orangeCost = function (price){
var totalPrice = (price*5);
console.log("The cost of 5 oranges today is" + " " + totalPrice + " " + "dollars");
};
orangeCost(5);

Console log shows:
The cost of 5 oranges today is 25 dollars
The cost of 5 oranges today is 25 dollars

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


#2

Hi
your code is correct and works. Unfortunately it can not be validated as such by codecademy because it is waiting for a precise sentence to be printed. You should print only the total price without any other word

console.log(totalPrice);

#3

The companion to D.R.Y. is do not add what is not asked for. This exercise is explicit about what is expected. A number. That is all. Don't log anything else but a number.


#4

Thank you both! Apparently I like to interpret instructions my own way...


#5

It is true or false

var orangeCost = function (number)
{
var val = number * 5 ;
console.log (val +"$");
};
orangeCost(5);