Ad
  • Default User Avatar

    In fact I was caought up here too thinking the same thing, the answer is simple : it's about " Operator precedence "
    you've been thinking of that expression like this :

    return ( i+k > a.length ) || ( s.length >= a.slice(i,i+k).join('').length ? s : a.slice(i,i+k).join('') );

    In fact it is interpreted like this

    return ( i+k > a.length || s.length >= a.slice(i,i+k).join('').length ) ? s : a.slice(i,i+k).join('');

    Because the || operator take precedence over the ? operator