Functions Lesson 6 (DRY) Help


#1

Hello, can someone please correct this script? It seems to be doing the exact thing the error message at the bottom is saying it is not doing.

Here's a snap.

Thanks in advance!


var orangeCost = function (price) {
    var val = price * 5;
    console.log("This week I will pay" + " " + val + " " + "dollars" + " " + "for oranges!"); 
    }
orangeCost(5)

#2

Read the error. Your orangeCost function doesn't return 25.
So instead of consol.loging string with value.
return val;


#3

The problem is your string they wanted you to return only the value and not a string,

console.log("This week I will pay" + " " + val + " " + "dollars" + " " + "for oranges!");

you may even print out the val,

console.log(val) :slight_smile:


#4

Ah I see the problem now. Thank you both! :slight_smile:


#5

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