SOURCE

function pick(obj, arr){
    for(let i = 0; i < arr.length; i++) {
        obj[i] = arr[i];
    }
    return obj;
}

var obj=[];
var arr = [1, 2];
pick(obj, arr)
console.log("[" + obj + "]");
console 命令行工具 X clear

                    
>
console