Object 1:
{positive: ['happy', 'excited', 'joyful'], negative: ['depressed', 'sad', 'unhappy']}
Object 2:
{happy: 6, excited: 1, unhappy: 3}
What I want - Result:
{positive: 7, negative: 3}
How do I achieve this?
I have used the following to get the category object 2 falls into but I'm not sure how to dynamically create the third object as the size of these objects grow. I cannot use for...of or for...in due to eslint airbnb rules
function getKeyByValue(value) {
return Object.keys(object).find((key) => object[key] === value);
}