A parameter’s default value cannot be defined in the parameter list. Instead, you have to declare the parameter and then set its default value in the function body, like this:
init : function(variable1, variable2, variable3) { variable1 = variable1 || ""; variable2 = variable2 || ""; variable3 = variable3 || ""; }
This code uses a shorthand syntax to give each parameter a default value if a value was not passed to a parameter. It is functionally equivalent to the following:
init : function(variable1, variable2, variable3) { if (!variable1) { variable1 = ""; } if (!variable2) { variable2 = ""; } if (!variable3) { variable3 = ""; } }