{"id":182,"date":"2009-02-09T00:00:46","date_gmt":"2009-02-09T07:00:46","guid":{"rendered":"https:\/\/actionsnippet.com\/?p=736"},"modified":"2009-02-09T00:00:46","modified_gmt":"2009-02-09T07:00:46","slug":"in-operator","status":"publish","type":"post","link":"https:\/\/actionsnippet.com\/?p=182","title":{"rendered":"&#8220;in&#8221; Operator"},"content":{"rendered":"<pre class=\"brush: as3; title: ; notranslate\" title=\"\">\r\nvar obj:Object = {name: &quot;Joe&quot;, hobby: &quot;Guitar&quot;, age:&quot;80&quot;};\r\n\r\nif (&quot;name&quot; in obj){\r\n\ttrace(obj, &quot; has a name property&quot;);\r\n}\r\n\r\nif (&quot;x&quot; in obj == false){\r\n\ttrace(obj, &quot; doesn&#039;t have an x property&quot;);\r\n}\r\n\r\n\r\nvar mySprite:Sprite = new Sprite();\r\n\r\nif (&quot;currentFrame&quot; in mySprite == false){\r\n\ttrace(mySprite, &quot;does not have a currentFrame property&quot;);\r\n}\r\n<\/pre>\n<p>The &#8220;in&#8221; operator can be used to check if an object has a specific property. In the above example I test a standard Object instance and a Sprite instance for  a few different properties.<\/p>\n<p>I could see this operator being used when dealing with * (wildcard) datatypes and dynamic style code&#8230;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>var obj:Object = {name: &quot;Joe&quot;, hobby: &quot;Guitar&quot;, age:&quot;80&quot;}; if (&quot;name&quot; in obj){ trace(obj, &quot; has a name property&quot;); } if (&quot;x&quot; in obj == false){ trace(obj, &quot; doesn&#039;t have an x property&quot;); } var mySprite:Sprite = new Sprite(); if (&quot;currentFrame&quot; in mySprite == false){ trace(mySprite, &quot;does not have a currentFrame property&quot;); } The &#8220;in&#8221; operator [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,36],"tags":[3,4],"class_list":["post-182","post","type-post","status-publish","format-standard","hentry","category-dynamic","category-operators","tag-actionscript","tag-flash"],"_links":{"self":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=182"}],"version-history":[{"count":0,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=\/wp\/v2\/posts\/182\/revisions"}],"wp:attachment":[{"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/actionsnippet.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}