function listCompare(a, b) {
  const alen = a.length
  const blen = b.length
  for (let i = 0; i < alen; i++) {
    if (a[i] < b[i]) {
      return -1
    } else if (a[i] > b[i]) {
      return 1
    }
  }
  return alen - blen
}
Compares two arrays of numbers lexicographically and returns an integer value.

@param {number[]} a - The first array to compare
@param {number[]} b - The second array to compare
@returns {number} -1 if a is smaller than b, 1 if a is larger than b, 0 if a and b are equal
@example
listCompare([1, 2, 3], [1, 2, 4]) // returns -1 because the third element of the first array is smaller than the third element of the second array.