Help with 6. D.R.Y


What is wrong with this code? The error message I receive is "ReferenceError: Can't find variable: orangeCost"

var calculate = function (price) {
var orangeCost = price * 5;
console.log("£" + orangeCost);


you named your function calculate where it should be named orangeCost, which leads to the problem that the later use of orangeCost outside of the function is undefined.Have you heard about local variables yet? Also don't use "£" + infront of your output, it's generally a good idea to make your output more explicit then just a number, but here the test function expects only the number so any additional strings will cause problems.