Why is it doing this?


When I run my submit and save I get two outputs. I added a string to my code to give it some context and when I do this is outputs twice. When I remove the string and just have console.log(val); it works just fine, one output.

So my question is why does it run the output twice? I have no idea.

Replace this line with your code.


Hey there, I have the same problem. Also the answer is 25 as it should be, but it's not correct.

var orangeCost = function(price) {
var val = price * 5;
console.log("These oranges cost" + " " + val);

This is my code.


It only printed once when I tried, so I think it's just the way the lesson is structured.


Look at orangeCost("5"). The input is a string, not a number. So when it goes to the line price * 5, how do strings multiply by 5?


Envy, You are running the program from the command prompt in windows? I did not know you could do this.


Yes thank you. I also had this problem in another exercise and now I understand the difference between string and a number.


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