klasses = ['last'] && txt = '' if idx == (tabs.length - 1)
At the end of this statement klasses will contain "".
klasses = ['last'] and txt = '' if idx == (tabs.length - 1)
At the end of this statement klasses will contain ['last'] which was what I intended. But the first statement wasn't returning that.
A good explanation is here http://stackoverflow.com/questions/1426826/difference-between-and-and-in-ruby