Lession 6 query


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

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


there are two ways you can build a function:

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


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

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


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.


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


thank you for your feedback