¿Hay alguna manera de convertir Object.keys a vars que se puedan desestructurar para otro objeto?
entonces si tengo
let ob1 = { key1: 'value', key2: 'value2'} let dictionary = { key1: 'super value', key2: 'other value' }puede hacer esto
let { Object.keys(ob1) } = dictionaryUsa Object.assign y map()
let ob1 = { key1: 'value', key2: 'value2'} let dictionary = { key1: 'super value', key2: 'other value' } let res = Object.assign(...Object.keys(ob1).map(key => ({ [key]: dictionary[key] }))); console.log(res); { "key1": "super value", "key2": "other value" }