Question: what does the code below do?
export function compact(array: any[]) { var index = -1, length = array === null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (value) { result[resIndex++] = value; } } return result; }