Please help with the code


#1

What is the error in this code. It is printing out two times
And also giving error.

var orangeCost = function (price) {
var TotalCost= price*5;
console.log("Total " +TotalCost);
};
orangeCost(10);


#2

what's the error message?


#3

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


#4

it's because your function doesn't return anything.use return instead of console.log


#5

return ("Total" +TotalCost);

Its printing out the quates too


#6

can you please post the lesson link so i can check

don't use any string value just return the value


#7

https://www.codecademy.com/courses/javascript-beginner-en-6LzGd/1/1?curriculum_id=506324b3a7dffd00020bf661

Its a DRY lesson


#8

return TotalCost;


#9

but I want output as " The total cost is 50"


#10

sorry,in your own environment you can do whatever you want but here you must follow the instruction.

so your code was fine but here it'll not accept.


#11

Here this works

The way i got through this one


#12

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