Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何检查关联数组中是否包含特定键?我知道我可以遍历所有键,但我可以进行单步检查吗?
myObject.hasOwnProperty("field")
示例代码:
var dic:Object = new Object(); dic["field"] = "data"; trace (dic.hasOwnProperty("field")); //true trace (dic.hasOwnProperty("nofield")); //false