# JS exec() method warning

**URL:** <https://forum.servoy.com/t/js-exec-method-warning/15270>\
**Category:** Classic Servoy\
**Created:** [January 3, 2012, 8:52am UTC](https://forum.servoy.com/t/js-exec-method-warning/15270 "2012-01-03T08:52:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rioba](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rioba](https://forum.servoy.com/u/rioba)\
**Post date:** [January 3, 2012, 8:52am UTC](https://forum.servoy.com/t/js-exec-method-warning/15270/1 "2012-01-03T08:52:51Z")

</div>

In Servoy 6.04 (Mac OS x 10.7.2, JDK 1.6) I am using the RegExp method .exec() to test a RegExp against a text page. I need to get the .index property of the resulting array to know where the searched RegExp starts. This is the code

```auto
var pageAB = plugins.http.getPageData('http://xxxxxxxxx');
var regSearch = /(<tr>\n|<tr\ bgcolor="#F2F2F2">\n)<td\ ((bgcolor=\"(#5ADAF9|#60E0FF)\"\ rowspan=\"[0-9]\")|(rowspan=\"[0-9]\" bgcolor=\"(#5ADAF9|#60E0FF)\"))><big><b><a href=\"[\s|\S]*?\"\ title=\"[\s|\S]*?\"(class=\"bg-redirect\")*>[\s|\S]*?<\/a><\/b><\/big><\/td>/g;
var pageIndexes = [];
var pageExec = [];
while(pageExec){ 
pageExec = regSearch.exec(pageAB)
if(pageExec != null)
{
	pageIndexes.push(pageExec.index);
}}

```

While the results are correct (the indices for all the found occurrences of the RegExp) I always get a warning for pageExec.index ```  
The property index is undefined for the javascript type Array

```While

```

---

<div class="post-metadata">

**Author:** ![Joas](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/joas/32/5095_2.png) [@Joas](https://forum.servoy.com/u/Joas)\
**Post date:** [January 4, 2012, 10:59am UTC](https://forum.servoy.com/t/js-exec-method-warning/15270/2 "2012-01-04T10:59:39Z")

</div>

This should work:

```auto
/** @type {{index:Number}} */
var pageExec = [];

```

---

<div class="post-metadata">

**Author:** ![rioba](https://avatars.discourse-cdn.com/v4/letter/r/aca169/32.png) [@rioba](https://forum.servoy.com/u/rioba)\
**Post date:** [January 4, 2012, 11:25am UTC](https://forum.servoy.com/t/js-exec-method-warning/15270/3 "2012-01-04T11:25:45Z")

</div>

thanks, that works. I tried

```auto
/** @param {{index:Number}} */
var pageExec = []

```

I imagine I should better study JSDoc syntax.
