# Array item doesn't exist, so let's get stroppy... or not?

**URL:** <https://forum.kirupa.com/t/array-item-doesnt-exist-so-lets-get-stroppy-or-not/226598>\
**Category:** flash\
**Created:** [May 22, 2007, 3:04pm UTC](https://forum.kirupa.com/t/array-item-doesnt-exist-so-lets-get-stroppy-or-not/226598 "2007-05-22T15:04:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dthought](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/dthought/32/3573_2.png) [@dthought](https://forum.kirupa.com/u/dthought)\
**Post date:** [May 22, 2007, 3:04pm UTC](https://forum.kirupa.com/t/array-item-doesnt-exist-so-lets-get-stroppy-or-not/226598/1 "2007-05-22T15:04:05Z")

</div>

Okay, so here’s the situation. In AS2.0, Flash was a little more lenient with when things didn’t exist. This was valid:

```auto

if (typeof (this.storedPositions[curX][curY]) != 'undefined')
{
   // Return the value
}

```

But in AS3.0, it’s a little more snarky. If the [curX] item does not exist, it throws a hissy fit and makes much sadness. For example:

“TypeError: Error #1010: A term is undefined and has no properties.”

This has resulted in me doing something like so:

```auto

if (this.storedPositions[curX] is Object)
{
   if (this.storedPositions[curX][curY] is Object)
   {
      // Return the value
   }
}

```

I dunno… that just seems a little… inefficient.

Is there a better way of dealing with this situation?
