什么是“hasOwnProperty()”接口的等价物?

问题描述:

什么是“hasOwnProperty()”接口的等价物?什么是“hasOwnProperty()”接口的等价物?

我发现这个错误有关Adobe公司:https://bugs.adobe.com/jira/browse/FB-27683

除了try..catch语句什么解决办法?

对方回答是好,但你也可以使用

i['hasOwnProperty']('dispatchEvent') 
+0

这是有线,该方法是有它只是ISN” t在编译时定义。我甚至评论过Adobe票。 – 2011-03-06 20:58:55

你有没有考虑过这个?

if("foo" in bar){ ... 

其中“foo”是一个属性的名称,bar是对象引用作为Interface?

这是在行动中真实的场景:

import flash.events.IEventDispatcher; 
import flash.events.EventDispatcher; 

var i:IEventDispatcher = new EventDispatcher(); 
if("dispatchEvent" in i){ 
    trace(" I have dispatchEvent"); 
}