6 Dont Repeat Your Self


#1

var orangeCost = function(cost){
var price=5*cost;
console.log("total cost:"+" "+price+" "+"dollars");
};

orangeCost(5);

This gives me the result twice, but if I change orangeCost to something else like this -->

var orangeFost = function(cost){
var price=5*cost;
console.log("total cost:"+" "+price+" "+"dollars");
};

orangeFost(5);

it only gives me it once, but the site does not accept it as correct because I need to use orangeCost.


#2

orangeFost? Why?

The codecademy console has the habit of echoiing the last value, it can be really useful. Either way, just ignore it. It is not important


#3

orangeFost could have really been anything, but I am too lazy to change the entire variable name ahahha. Anyway I just did print instead of of console.log and it worked C: