It keeps showing me an error wher there is none


I have problem with Function and Return, excersice Don't repeat yourself at JavaScript tutorials.

I think that the function i wrote is correct, but it keeps telling me that there is a mistake in my code.

<img src="//" width="690" height="388">
var orangeCost = function(price){
    var cost = price * 5;
    console.log("Cost is: " + cost);



This is sort of a funny problem actually. Don't worry your code is completely fine! But what about the error? The lesson has a problem with your console.log. See when you called your function and console.log it conflicted with what the lesson wanted originally so it raised an error. Get rid of your console.log and you will pass the lesson. Not exactly sure why the trouble but I believe it is because the lesson wanted just one line on the console of cost is: 25 not two and it wanted you to accomplish that through calling your function not a console.log.


Thank you for the answer!
When i remove the console.log() the code works fine.


No problem! Glad to have been of service.


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