ternary operator JS

//if a[4] is less than b[4], return negative 1, otherwise, return 1
//if(boolean)?whenYes:whenNo;
return a[4]<b[4]?-1:1;

 

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator

Advertisements
ternary operator JS