I think there's a bug with codecademy.com. Help me out here, please


#1

function orangeCost(price) {
var totalPrice = price * 5;
console.log("The cost for 5 oranges at $" + price + " each is $" + totalPrice + ".");
};

orangeCost(5);

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

WHY IS THAT? The code is right.


Replace this line with your code.


#2

your function needs to return the totalPrice, currently it logs this to the console.

Only return the value, without additional string


#3

But here are the instructions:

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.


#4

Thank you so much for your prompt response btw.

EDIT: I changed console.log to return and it let me progress forward. I guess I read the instructions literally, so that was probably why.

Thank you for your help.


#5

you didn't include the exact exercise you where stuck at, so i only go with the error message (which was a bit misleading)

you should actually log totalPrice without additional string, sometimes doing more then required can cause problems in the exercise validation.


#6

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