D.r.y.?


#1

I got the code right but I don't quite understand. What's the use of the 2nd line? And why repeat the 5 in the third line?

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


#2

so, you don't want to repeat yourself, so you build a function:

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

now this function is nice, but it is not going to execute unless you call it:

orangeCost(5);

so i would put the function call outside the function


#3

The 2nd line is a reusable block of code in the funtion or it's the code that you want to excuate. The price is a argument that is a parameter you can use wherever you want in the block of the code...After you define a funtion ,you can call it,so the third line code is that you call it at the same time you pass a argument to the function.