function pick(obj, [key1, key2]) { obj.push(key1); obj.push(key2); return obj; } var obj = []; console.log(pick(obj, [1, 3]));