📜  在 key = value jquery 中组合 2 个数组的值 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:07.411000             🧑  作者: Mango

代码示例1
var keys = ['a', 'b', 'c'],
    values = [1, 2, 3],
    associated = keys.reduce(function (previous, key, index) {
        previous[key] = values[index];
        return previous
    }, {})

console.log(associated) // Object {a: 1, b: 2, c: 3}