showButton(button, {playing}
A link to the code for further investigation would be appreciated.
function playButton(button) {
var player = getAudio();
var playing = isPlaying(button);
showButton(button, {
playing
} manageAudio(player, {
playing
});
}
This is what you did.
showButton(button, {
playing
}; manageAudio(player, {
playing
});
The opening parenthesis of the showButton function call, doesnât have a matching closing parenthesis yet, which needs to go after the first closing curly brace.
Starting manageAudio
on a new line will be helpful too.
function playButton(button) {
var player = getAudio();
var playing = isPlaying(button);
showButton(button, {
playing
}
manageAudio(player, {
playing
});
Youâve started manageAudio on a new line, but thereâs all of this that you havenât done yet:
[quote=âPaul_Wilkins, post:1150, topic:282569, full:trueâ]
The opening parenthesis of the showButton function call, doesnât have a matching closing parenthesis yet, which needs to go after the first closing curly brace.[/quote]
Itâs trying to find a closing parenthesis and is puzzled that after a lot of searching, that itâs finding a closing brace further down instead.
The opening parenthesis of the showButton function call doesnât have a matching closing parenthesis yet, which needs to go after the first closing curly brace.
matching closing parenthesis
closing curly brace.
All confusing.
Letâs help to clear things up then.
Parenthesis look like this: ( )
Curly braces look like this: { }
Square brackets look like this: [ ]
When you have one parenthesis mark, such as a left, or opening, parenthesis, (
The matching one for that is a right, or closing, parenthesis, )
.
Each left must be matched with a matching right one of the same type.
An opening curly brace looks like this: {
And its matching closing one looks like this: }
function playButton(button) {
var player = getAudio();
var playing = isPlaying(button);
showButton(button, {
playing
}
manageAudio(player, {
playing
});
{
It looks like you are making the situation worse.
All you need to do is to close off the call to the showButton() function, in the same way that you are closing off the call to the manageAudio() function.
This
});
in the same way
function playButton(button) {
var player = getAudio();
var playing = isPlaying(button);
showButton(button, {
playing
} });
manageAudio(player, {
playing
});
The closing curly brace ends the object, the closing parenthesis ends the arguments for the function thatâs being called, and the semicolon ends the statement.
How?
showButton(button, {
playing
}
manageAudio(player, {
playing
});
How?
The following code calls the sum() function.
var total = sum(1, 2);
The sum
refers to the name of the function being called.
The left parenthesis marks the start of the arguments list.
The right parenthesis marks the end of the arguments list.
Together, the left parenthesis and the right parenthesis enclose the arguments being given to the function.
Those arguments in this case happen to be the two values of 1, and 2.
The semicolon indicates that itâs the end of the statement.
function playButton(button) {
var player = getAudio();
var playing = isPlaying(button);
showButton(button, {playing}
manageAudio(player, {playing});