samedi 21 janvier 2017

When would you use hasOwnProperty on an array?

I have just seen an example where the code is as follows:

var schemaSet:Array = currentScope();
if (schemaSet.hasOwnProperty("current"))
    schema = schemaSet["current"];

I have never seen this before. I checked the as3 docs and didn't find any information on it. When and where would you use this? Is this better than or equivalent to:

if (schemaSet.indexOf("current")!=-1)

Aucun commentaire:

Enregistrer un commentaire