Lesson 6 how to multiply by 5


#1

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

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. 
var orangeCost = function(cost)
{ console.log("the price this week is £" + cost*5); }
orangeCost("5")

#2

when you call the function:

orangeCost("5")

why is 5 a string?

your function should log 25 to the console, not log string + 25 to the console


#3

I also need help with this one, I am facing the exact same problem! Help please


#4

If you face the exact same problem, my suggestions should help|? If they don't, please go here and make a new topic, fill in the template so we have the information needed to help you, you currently did not provide this information


#5

I am having the same problem. Here is my code:

var orangeCost = function (price) {
console.log("The cost today is " + price*5);
};
orangeCost(5);

Which prints out "The cost today is 25"

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


#6

so I'm not sure what is wrong with your code, because it looks fine. I checked what I have and instead of the parameter of price I have cost. maybe that's whats wrong but I'm not certain. also I only have console.log(cost * 5); not all of the extra strings. honestly I don't know if this will help but I cant find anything wrong with your code.


#7

Thank you! There is actually nothing wrong with my code. I misunderstood the directions!! The tutorial was asking for a number, not a sentence. :stuck_out_tongue:


#8

no problem. good luck with the rest of the class!


#9

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