I run into the same error over and over again within the debugger, "SyntaxError: missing ) after formal parameters".
Here are my parameters I set:
var CircleOptions = {
posBall: {
x: 160,
y: 180
},
radius: 40,
startAngle: 0,
endAngle: Math.PI * 2,
anticlockwise: false,
radians: 0,
xMove: Math.random(),
yMove: Math.random(),
speed:2,
angle:80,
velocityX:1,
velocityY:1
};
This is my code:
function CircleCoordinates(CircleOptions.posBall.x, CircleOptions.posBall.y, CircleOptions.radius) {
var left = CircleOptions.posBall.x - CircleOptions.radius,
top = CircleOptions.posBall.y + CircleOptions.radius,
right = CircleOptions.posBall.x + CircleOptions.radius,
bottom = CircleOptions.posBall.y - CircleOptions.radius;
};
I get the same error as well when I enter my functions as well:
function CircleCoordinates(CircleOptions.posBall.x, CircleOptions.posBall.y, CircleOptions.radius) {
var left = CircleOptions.posBall.x - CircleOptions.radius;
var top = CircleOptions.posBall.y + CircleOptions.radius;
var right = CircleOptions.posBall.x + CircleOptions.radius;
var bottom = CircleOptions.posBall.y - CircleOptions.radius;
};
Can anyone be so kind as to tell me what is wrong? :)
The "SyntaxError: missing ) after argument list" occurs when we make a syntax error when calling a function, e.g. forget to separate its arguments with a comma. To solve the error make sure to correct any syntax errors in the arguments list of the function invocation. Copied!
"Formal parameter" is a fancy way of saying "function parameter". Your function declaration is missing valid parameters. In the declaration of a function, the parameters must be identifiers, not any value like numbers, strings, or objects. Declaring functions and calling functions are two separate steps.
The JavaScript exception "missing ) after argument list" occurs when there is an error with how a function is called. This might be a typo, a missing operator, or an unescaped string.
formal parameter — the identifier used in a method to stand for the value that is passed into the method by a caller. For example, amount is a formal parameter of processDeposit.
function CircleCoordinates(CircleOptions) {
var left = CircleOptions.posBall.x - CircleOptions.radius,
top = CircleOptions.posBall.y + CircleOptions.radius,
right = CircleOptions.posBall.x + CircleOptions.radius,
bottom = CircleOptions.posBall.y - CircleOptions.radius;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With