6/13 Need help


#1

Please what could be wrong here. The display om my right gives me 3 instead of 15. the error message is Oorangecost is not defined:

var orangeCost= function(price)
{var val= price*5; console.log(val); };
 orangeCost=(3);

#2

This part does not call your function but overwrites it with the value 3 (which is as it is the last value) shown in the screen.
So instead call orangeCost(3) or whatever is required in the instructions. I guess most call orangeCost(5).


#3

I have debugged it.i wrote orangeCost=(3) instaed of orangeCost(3). No need for the = sign. Thanks all the same


#4

i wonder:

var orangeCost = function(price) {
  var val = price * 5; {
    console.log(val);
  }
};
orangeCost(5);

works just fine, but this one seems right to me too:

var orangeCost = function(price) {
  console.log("the cost of your oranges is" + " " + (price * 5))
};
orangeCost(5);

Why is the "second" version wrong?
Thanks!!


#5

Its not "wrong" it's just more than the test function expects. If you expect to see a number and check for a number and you then get a string you might be confused.