Object Parameter/Function and/or Ternary Operator Confusion
<p>Sorry for the ambiguous "Title" but I'm struggling to come up with one that captures my question pithily. </p>

<p>I'm working through R Murphy's <a href="http://jqfundamentals.com/book/index.html" rel="nofollow">JQuery Fundamentals</a> and am stuck on a snippet of code in her solution: <a href="https://github.com/rmurphey/jqfundamentals/blob/master/solutions/slideshow.js" rel="nofollow">slideshow.js</a>.</p>

<p>She's created the following function (I've removed some of the navigation code in order to focus on the core functionality of fading images in and out):</p>

<pre><code>fadeCallback = function() {
            if (manualMode) { return; }

            var $this = $(this),
                $next = getItem($this, 'next'),
                num = $this.prevAll().length + 1;

            // set the timeout for showing
            // the next item in 5 seconds
            timeout = setTimeout(function() {
                showItem($this, $next);
            }, 5000);
        };
</code></pre>

<p>Inside fadeCallback she calls getItem() to get the next sibling of $this:</p>

<pre><code>getItem = function($item, trav) {
            var $returnItem = $item[trav]();
            return $returnItem.length ? 
                $returnItem : 
                $items[(trav == 'next') ? 'first' : 'last']();
        },
</code></pre>

<p>It seems to me that inside getItem(), in the line...</p>

<pre><code>$items[(trav == 'next') ? 'first' : 'last']();
</code></pre>

<p>...trav is never <strong>not</strong> going to be 'next'. i.e. Nowhere else in the code do we set 'trav' to anything but 'next'. Yet by virtue of the code testing whether trav equals 'next' it implies that there are cases where trav != 'next'. But I can't identify any such case.</p>

<p>What am I not seeing?</p>

<p>Many thanks in advance,
n</p>
