Having problem with my javascript code can't understand


#1

Hi, I am having problem in my javascript code and i can’t understand if Here is a code and description.
You are a creature of habit. Every week you buy 5 oranges. But orange prices keep changing!

You want to declare a function that calculates the cost of buying 5 oranges.
You then want to calculate the cost of the 5 all together.
Write a function that does this called orangeCost().
It should take a parameter that is the cost of an orange, and multiply it by 5.
It should log the result of the multiplication to the console.
Call the function where oranges each cost 5 dollars.

Here is a code i have write it gives answer but it also shows an error.

var orangeCoast = function(price)
{
console.log(5 * price);
}
orangeCoast(6);

it showes error message “Oops, try again. It looks like you didn’t define orangeCost.”


#2

you misspelled orangeCost, you wrote Coast


#3

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