# 6. Dont Repeat Yourself stumped on math

#1

<Below this line, add a link to the EXACT exercise that you are stuck at.>
<In what way does your code behave incorrectly? Include ALL error messages.>
var orangeCost = function(cost) {
var price = 10;
var total = price *5;

console.log(total) }
orangeCost()Oops, try again. Hmm, it looks like your orangeCost() function doesnâ€™t return 25 when the cost of an orange is 5.

``````

Replace this line with your code.

``````

#2

got this weird error code i am confused how does make sense?

var orangeCost = function(cost) {
var price = 10;
var total = price *5;

console.log(total) }
orangeCost()

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

i do not understand this at all

#3

Hi coreplayer

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

The exercise wants you to `return` the value. Now see what you are doing:

``````// where is the return statement?
var orangeCost = function(cost) {
var price = 10;
var total = price *5;

console.log(total) }
orangeCost()
``````

Can you now fix the error?

#4

return the value? i dont know how to put it i keep getting syntax error

#5

Ok, sorry, I found your mistake:

``````var orangeCost = function(cost) {
var price = 10;
var total = price *5;
``````

You do not have to multiply by 5 your own value. As per instruction 4,

It should take a parameter that is the cost of an orange, and multiply it by 5.

Reading it carefully, we find that `total` should be equal to the parameter (`cost`) multiplied by five. Can you now fix the error?

#7

yes okay i have fixed it thank you. but i am still confused why it would give an error message as if it was mathematically incorrect

#8

if it was mathematically incorrect

Well, it was incorrect according to the instructions of the exercise

#9

This java tutorial is 10x worse than any other lessons Iâ€™ve seen on this site.

#10

This is Javascript. Before randomly criticising a course, make sure you know which one you want to criticise.

I personally thought that it was a great course, and now I know a lot more than I did by using books prior to joining Codecademy in 2014.

#11

u havenâ€™t seen python then

#13

This JavaScript tutorial is very good i think.
First check the programming language we are using here, then understand the problem by reading the instructions as many times as you need to, finally criticize in a constructive way always!