Check this code please :) I'm stuck at (D.R.Y) functions #6


var buyOranges = function "orangeCost"(price)
  ((price) * 5);


The instructions ask for a function named oranageCost.

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


Hello, Can you please let me know why am i getting the output printed twice? And even when I change my price value (input parameter), the second statement printed still shows $25 (for $5 price) under the first statement which actually gives the right result for total cost of 5 oranges for the given price as input.

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



I did it like this and it worked out very well :var orangeCost =

function(price = 5)
console.log(orangeCost * 5)


It may be printing twice because the SCT is running the program to test its output. If I recall correctly, there should be no additional text in the output, just the number 25.

This is not how the program is meant to look. It should not have passed.