I grabbed this code form JCarousel and just trying to understand these lines below. I\'m new to jQuery and not that great at JavaScript so I am not sure what is jQuery and
[n ? 'bind' : 'unbind']
Is an if statement, which can be rewritten as
if (n) // if n is true
{
'bind';
}
else
{
'unbind';
}
So if n is true, it would evaluate like this
this.buttonNext.bind((this.options.buttonNextEvent, this.funcNext))
because [ ] notation is the same as . notation.
buttonNext[bind] is the same as buttonNext.bind
To summarize what you posted, it checks the states of variables (n and p) which holds the state of the button. If it is enabled, then when activated it disables it, adds the disabled classes, etc. If it's disabled, it sets it to enabled and removes the disabled class.