The first part to understand is symbol resolution. Javacript supports both dot-notation and bracket-notation.
Consider opening a new window.
window.open()
This is dot-notation in action. you're telling the interpreter that "open" can be found on "window". But there's another way to do this
window['open']()
Same thing, but with bracket notation. Instead of using the symbol name directly, we're using a string literal instead. What this means is that by using bracket-notation for symbol resolution, we can do it in a dynamic way, since we can choose or build strings on the fly, which is exactly what this snippet does.
this.buttonNext[n ? 'bind' : 'unbind'](...);
Is analagous to
if ( n )
{
this.buttonNext.bind(...);
} else {
this.buttonNext.unbind(...);
}
If you don't recognize the ?: syntax, that's the conditional operator, or conditional expression
[expression] ? [valueIfTrue] : [valueIfFalse]
This is extremely often erroneously called the "ternary operator", when in fact it just a ternary operator (an operator with three operands). The reason for this is because in javascript (and most languages) is the only ternary operator, so that description usually flies.
Does that help? is there anything else you need cleared up?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…