Use of a js Code

  node.js, question

Today, when looking at the source code, I accidentally saw this passage, which reads as follows:

length = start > end ?   0 : ((end - start) >>> 0);

This is a section of a function called baseSlice () in lodash. Native Code is:

function baseSlice(array, start, end) {
 var index = -1,
 length = array.length;
 
 if (start < 0) {
 start = -start > length ?  0: (length plus start);
 bracket
 end = end > length ?   length : end;
 if (end < 0) {
 End plus = length;
 bracket
 length = start > end ?   0 : ((end - start) >>> 0);
 start >>>= 0;
 
 var result = Array(length);
 While (plus index < length) {
 Result[index] = array[index plus start];
 bracket
 return result;
 bracket

So the question is, what’s the use of this > > 0? What is the difference between this and the ordinary end-start?

I only know some basic applications of positional operator, such as 1<<1, which is equivalent to 1*2. This is my first time to see it.

I went to search on the internet and found no definite answer.

Pray for the great god to spread science and expand knowledge, thank you.

The shift operation can only be applied to integers, which means (end-start) is converted to a positive integer.