const barker = (state) => {
bark: () => console.log('Woof, I am ' + state.name)
}
const barker2 = (state) => ({
bark: () => console.log('Woof, I am ' + state.name)
})
barker===barker2 //returns false
My goal is to use Object.assign within a factory function and use 'barker' as an input. 'barker' doesn't work but 'barker2' works. Why does it work with the set of parenthesis? I understand IIFE's but this isn't immediately called so I don't understand what's happening here.