JS Recursive GetLength of Array

function getLength(array) {
    return 0 in array ? 1 + getLength(array.slice(1)) : 0;
}

console.log(getLength([1]));             // 1
console.log(getLength([1, 2]));          // 2
console.log(getLength([1, 2, 3, 4, 5])); // 5
console.log(getLength([], 0));           // 0
Energetic Eel