DEV Community

Discussion on: Pub-Sub pattern: a brief explanation

Collapse
 
ganeshshetty195 profile image
Ganesh Shetty

You cant compare a function like that , function will be compared based on reference just like object
So it will return false even though is same

Collapse
 
jucian0 profile image
Jucian0 • Edited

You are right, function will be compared base on reference, like an object.

But here I need to validate if the fn argument in the subscription and the fn argument in the unsubscription are located ate the same point of memory, if true, it means that is the same function.