I need to overwrite this javascript object every time it iterates
const emotions = {
happy: '',
neutral: '',
sad: '',
angry: '',
fear: ''
}
Here "gestures" is iterated and I do destructuring of "emotion" and "score" and then overwrite the one that is changing but does not, it just adds a new method to the object
gestures.forEach(({emotion, score})=>{
emotions.emotion = Math.trunc(100 * score)
});
console.log(emotions);
What would be the best way to do it? Thanks in advance.