Geting trouble with a part

java

#1

Hello I've seen to be geting trouble with the introductions to funcitons Dont repeat your self (D.R.Y).
Ive mostly been having problems with How to use functions. And in the way they worked.

SO what im asking if you can explain a little more on how funtions work and what may be my problem in this code

var orangemoney = function(orangeCost)
var price = function(Cost)
{orangemoney(5)
orangeCost (5)
var val = orangeCost * 5
console.log(val)

}


#2

Wow @niceme3! You misunderstood the concept. I will show you step by step to complete this exercise.

Firstly:

create a function called orangeCost with a parameter that is the cost of an orange,.(you can name your parameter anything you like)

So like this:

var orangeCost= function(orange){

}

Secondly

multiply it by 5.It should log the result of the multiplication to the console.
So like this

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

Last but not least

Call the function

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

Hope this helped!


#3

Thanks dude now i understand. Thanks