I would call myself an intermediate jQuery developer, but I’m confused about what this line (from Twitter’s Bootstrap) is doing:
$tip.find('.help-popover-title')[ $.type(title) == 'object' ? 'append' : 'html' ](title)
Specifically, the part between the square brackets. Can anybody explain it to me?
The inner statement uses a ternary operator. It’s basically a single line
if..elsestatementSince the selected method is inside the brackets, you can use a string to select a method
It’s equalvelent to: