SOURCE

function isSubset(parent, child) {
    let parentLength = parent.length
    let childLength = child.length
    if(child[0] < parent[0] 
    || child[childLength - 1] > parent[parentLength -1]) {
        return false
    }
    for(let i = 0, j = 0; j < parentLength; ) {
        if(child[i] > parent[j]) {
            j ++
        } else if(child[i] === parent[j]){
            i ++
        } else {
            return i >= childLength
        }
    }
}
console.log(isSubset([1, 2, 3, 4, 5], [1, 2, 3]))
console.log(isSubset([1, 2, 3, 4, 5], [1, 2, 3, 7]))
console.log(isSubset([1, 2, 3, 4, 5, 8], [1, 2, 3, 7]))
console 命令行工具 X clear

                    
>
console