Lession 6 query


#1

var orang=orangeCost(price){
var cost=5*price
console.log("cost of five oranges are:"+cost);
}
orang(6);

what is problem over here?
help me to solve lesson 6 exercise


#2

there are two ways you can build a function:

function square(number) {
  console.log(number * number);
}

and:

var square = function(number) { 
    console.log(number * number);
 };

i am not sure which you want to use, but you never a function keyword


#3

sorry i did'nt get you... i am learning javascript and here is no return statement in lession 6. i am doing example of "oranges" can you provide its solution so that i can understand it properly.


#4

return is irrelevant. It is about the function deceleration i showed.

In your case:

var orang=orangeCost(price)

you never use the function keyword, i showed how to declare a function (the two possible ways) but both require a function keyword (which you don't have)

If you need more help, post an updated version of your code


#5

thank you for your feedback


#6