Don't Repeat Yourself


#1

(https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/1/1?curriculum_id=506324b3a7dffd00020bf661#)

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

Replace this line with your code. 
var price = 5
var cost = price * 5
var orangeCost = function(price) {
    var val = 5 * 5
    console.log("The cost is" + cost );
}
orangeCost("5")

#2

Hi this line

orangeCost("5")

remove the " " around 5 then here

console.log("The cost is" + cost );

remove the string

"The cost is"

and it's better iof you this line inside the function

var cost = price * 5

#3

I figures that out but thx though thats exactly what I did.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.