It in fact isn't possible. The numbers are automatically converted into strings.
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
I've been there..
This comment is hidden because it contains spoiler information about the solution
Loading collection data...
It in fact isn't possible. The numbers are automatically converted into strings.
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
I've been there..
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution