SyntaxError. I'm not sure what I'm doing wrong. Please respond.orangeCost


#1

I keep getting different SyntaxErrors this is my code. Can somebody please help?

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

I'm getting

 SyntaxError: Expected ')'

Thanks.


#2

var orangeCost = function (price * 5) {

A parameter should be a varaible name that gets it's value from the function call so e.g. use just price. Than you would assign 5 (not "5") to price by using orangeCost(5). Last but not least you need to move the *5 from the parameter place where it was incorrect into the console.log where it is correct.


#3

Thank you so much! It works now. :smile: