5. Tying it all together


#1

Error: Oops, try again. Hmm, it looks like your orangeCost() function doesn't return 25 when the cost of an orange is 5.

Code:

var orangeCost = function (price) {
    var val = price * 5;
    console.log("the cost of oranges is " + val);
};

orangeCost( 5 );

#2

use return instead of console.log

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

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.