js实现改变原来对象中的键值对对应的值
2020-04-30 本文已影响0人
编程小橙子

直接看代码吧
let jsonObject = {a:1,b:2,c:3}
const { b, ...result } = jsonObject;
console.log(result) //{a:1,c:3}
result['b'] = 'hello'
console.log(result) //{a:1,c:3,b:'hello'}
let jsonObject = {a:1,b:2,c:3}
const { b, ...result } = jsonObject;
console.log(result) //{a:1,c:3}
result['b'] = 'hello'
console.log(result) //{a:1,c:3,b:'hello'}