Can somebody explain how John Resig's pretty.js JavaScript works?
<p><a href="http://ejohn.org/files/pretty.js" rel="nofollow">http://ejohn.org/files/pretty.js</a></p>

<pre><code>// Takes an ISO time and returns a string representing how
// long ago the date represents.
function prettyDate(time){
    var date = new Date((time || "").replace(/-/g,"/").replace(/[TZ]/g," ")),
        diff = (((new Date()).getTime() - date.getTime()) / 1000),
        day_diff = Math.floor(diff / 86400);

    if ( isNaN(day_diff) || day_diff &lt; 0 || day_diff &gt;= 31 )
        return;

    return day_diff == 0 &amp;&amp; (
            diff &lt; 60 &amp;&amp; "just now" ||
            diff &lt; 120 &amp;&amp; "1 minute ago" ||
            diff &lt; 3600 &amp;&amp; Math.floor( diff / 60 ) + " minutes ago" ||
            diff &lt; 7200 &amp;&amp; "1 hour ago" ||
            diff &lt; 86400 &amp;&amp; Math.floor( diff / 3600 ) + " hours ago") ||
        day_diff == 1 &amp;&amp; "Yesterday" ||
        day_diff &lt; 7 &amp;&amp; day_diff + " days ago" ||
        day_diff &lt; 31 &amp;&amp; Math.ceil( day_diff / 7 ) + " weeks ago";
}

// If jQuery is included in the page, adds a jQuery plugin to handle it as well
if ( typeof jQuery != "undefined" )
    jQuery.fn.prettyDate = function(){
        return this.each(function(){
            var date = prettyDate(this.title);
            if ( date )
                jQuery(this).text( date );
        });
    };
</code></pre>

<p>How exactly is the prettyDate() method returning a string? Is this another one of those 'strange' things you can do in JavaScript or am I just missing something?</p>

<p>edit: I didn't ask how he's returning a value, I asked how he's returning a string.</p>

<p>return day_diff == 0 &amp;&amp; (....) returns a boolean in any language I've ever used.</p>
