# D.R.Y Don't Repeat Yourself error

#1

var orangeCost = function (price)

{
console.log(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

#2

What do the instructions say to do?

Is your function acting as intended?

Did you test it with multiple inputs?

#3

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.
?

#4

yes i tested it with multiple inputs

#5

Did it work as intended with multiple inputs?

#6

It should log the result of multiplication.

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

#7

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

#8

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

#9

the parameter is accepting the equation, its just outputing twice

#10

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

#11

what do you mean by this

#12

how do I insert a equation into the function

#13

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

Tjis is the correct code it worked i figured it out

#14

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.