The isPrototypeOf() function in JavaScript checks if an object exists in another object's prototype chain. isPrototypeOf() is implemented in the Object prototype, which means that all objects in JavaScript have access to it.
We can use the isPrototypeOf() function from the rxjs library as follows:
263 chars8 linesIn the above example, we import the isPrototypeOf function from the rxjs/internal-compatibility module. We create a new Object and an Observable from that object using the of method.
Finally, we check if the Object.prototype is a prototype of the obj and if the Rx.Observable.prototype is a prototype of the observable using the isPrototypeOf function. Both the console.log() statements will output true.
Note that isPrototypeOf() returns a boolean value indicating whether an object exists in another object's prototype chain.
gistlibby LogSnag