I cant seem to calculate with my code using JS. What am i doing wrong?
var orangeCost = function(price * 5)
That's my code, but i doesn't work. Could you please help me?
It says "Unexpected token *"


Hi @coding_is_awesome

Your code should be looks like

var orangeCost = function(price){
    return price * 5;


Do you understand those changements ?


What does the return part do?


He stops the execution of the function and returns a value from that function.

It's all what I know about return statement. And you @lolman ?


But do you know why it says that * is not correct in this code? (my previous)
Just for knowing in the future.


No I can't know, I think it depends of your code :confused:


I cant use > or < either, it says the same


Show me it I'm going to check


I think i get it: if you do 'var orangeCost = function()' you cant put any calculative stuff between the ()


Why is there a (3) behind orangeCost?


var orangeCost = function(price){  //no calculative stuff between (), here is function's parameters, just put value who will call
    return price * 5;              //here you put calculative stuff or other, price will be replace to the value who will put

orangeCost(3);                     //now, you call the function and put a parameter, orangeCost's going to do 3 * 5 and return result