D.R.Y Don't Repeat Yourself error


var orangeCost = function (price)


orangeCost(5 * 5);

that is my code but the computer outputs twice with the first output being 25 and the second output being 5 please help


What do the instructions say to do?

Is your function acting as intended?

Did you test it with multiple inputs?


here are the instructions
You are a creature of habit. Every week you buy 5 oranges. But orange prices keep changing!

You want to declare a function that calculates the cost of buying 5 oranges.
You then want to calculate the cost of the 5 all together.
Write a function that does this called orangeCost().
It should take a parameter that is the cost of an orange, and multiply it by 5.
It should log the result of the multiplication to the console.
Call the function where oranges each cost 5 dollars.


yes i tested it with multiple inputs


Did it work as intended with multiple inputs?


It should log the result of multiplication.

Your function doesn't do any multiplication at the moment.


it only outputed one output if i put only one digit in the last part iof the code "orangeCost(25)" but if i put in a mathematuical equation like i originally did it would output 2 outputs


If you entered 25 into your function, it should output "125".

Think about what your function is supposed to do.


the parameter is accepting the equation, its just outputing twice


You don't want an equation in the parameter, you want the function to do it for you...


what do you mean by this


how do I insert a equation into the function


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

Tjis is the correct code it worked i figured it out


Yes that's the right one.

What you did with your previous code was you put the multiplication part in the "calling" part by doing this:
orangeCost(5 * 5)

So you will not forget this in the future, always remember to do the "actions" or the equation or multiplication part within the creation of the function. Just like what you did above. So that when you reuse the function you will not have to do any multiplication anymore.

Great job figuring it out! Way the go.