# 6 D.R.Y Super lost been on this quest for a week now XD

#1

``````var cost = prompt("How much is each Orange?")
var orangeCost = function(Total)
{
(cost*5);
return (cost*5);

}
Total``````

#2

What can we do for you?

#3

multiply 5 by your function parameter Total like this:
`(Total*5);`

then call your function like this:

orangeCost(5);

you dont need the prompt statement

#4

First of all thank you very much for your help.So what you are saying is to Replace function(Total) to function(5). But isn't 5 what triggers the function? I ask because I am really trying to understand this completely. I have read and used other peoples functions that pass the assignment but I have yet to fully understand =(.

#5

``````var orangeCost = function(cost) {
return cost * 5
}
console.log(orangeCost(8));``````

This is another way of doing it, but basically cost is the value of the function.

In this method you return cost and times it by 5 as they want to know the price of 5 oranges.
Then because return doesn't print anything to the console you use console.log( )
then inside you're calling the orangeCost function and giving it a value between the ()

therefor console.log(orangeCost(8)); will print to the console, 8 * 5 in this circumstance, you can change the 8 to anything you want there as it's representing orangeCost(cost) <-- whatever number you would want goes here

#6

Thank for another solution. I just really wanted to get this assignment done by using the prompt technique. I somewhat understand now well continue to look into this until I have complete clarity.

#7

You could do it with a prompt but it would be like this

``````var price = prompt("How many oranges do you want to buy?");
var orangeCost = function(price) {
return price * 5;
};
console.log(orangeCost(price));``````

#8

Awesome I am going to give this a try and see thank you .