Can someone explain me why using JavaScript instanceof operator as the side effect to convert its left operand to the type of its right operand.

An RDF example:

// rsc is an object of type nsIRDFNode

rsc instanceof Components.interfaces.nsIRDFLiteral;

// now resource can be used as an is an object of type nsIRDFLiteral
// same as
// rsc = rsc.QueryInterface(Components.interfaces.nsIRDFLiteral);

Is this shortcut safe?

Daniel




Reply via email to