# Javascript foreach

**URL:** https://forum.servoy.com/t/javascript-foreach/4696
**Category:** Classic Servoy
**Created:** [September 3, 2005, 7:41pm UTC](https://forum.servoy.com/t/javascript-foreach/4696 "2005-09-03T19:41:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![leemcneil](https://avatars.discourse-cdn.com/v4/letter/l/cc9497/32.png) [@leemcneil](https://forum.servoy.com/u/leemcneil)
#### Post date: [September 3, 2005, 7:41pm UTC](https://forum.servoy.com/t/javascript-foreach/4696/1 "2005-09-03T19:41:10Z")

</div>

This may sound rather boring, but whilst coding today I realised that “foreach” flow statement isn’t present in the Servoy JavaScript.

Please add this in for the next release, as now there is no simple way of walking through an associative array.

Cheers,

Lee.

---

<div class="post-metadata">

### Author: ![AGhisalberti](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@AGhisalberti](https://forum.servoy.com/u/AGhisalberti)
#### Post date: [September 5, 2005, 12:46pm UTC](https://forum.servoy.com/t/javascript-foreach/4696/2 "2005-09-05T12:46:59Z")

</div>

AFAIK it’s absent even in JavaScript 1.5 (EcmaScript v3).  
Don’t know about JScript 5.

Armando

---

<div class="post-metadata">

### Author: ![leemcneil](https://avatars.discourse-cdn.com/v4/letter/l/cc9497/32.png) [@leemcneil](https://forum.servoy.com/u/leemcneil)
#### Post date: [September 5, 2005, 4:04pm UTC](https://forum.servoy.com/t/javascript-foreach/4696/3 "2005-09-05T16:04:19Z")

</div>

OK, I’m a twat - please disregard. ![:oops:]( "Embarassed")

Obviously a tad bit rusty on the old javascript syntax, too many languages running riot in my head. For anyone as dense as I am today here is the javascript version of foreach that works in Servoy:

```auto
for(var key in associativeArray)
{
    application.outupt(key);
}

```

Lee. ![:roll:]( "Rolling Eyes")

---

<div class="post-metadata">

### Author: ![AGhisalberti](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@AGhisalberti](https://forum.servoy.com/u/AGhisalberti)
#### Post date: [September 5, 2005, 8:12pm UTC](https://forum.servoy.com/t/javascript-foreach/4696/4 "2005-09-05T20:12:28Z")

</div>

> leemcneil:  
> too many languages running riot in my head

ah, been there! ![:lol:]( "Laughing")

Armando

---

<div class="post-metadata">

### Author: ![AGhisalberti](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@AGhisalberti](https://forum.servoy.com/u/AGhisalberti)
#### Post date: [December 18, 2005, 11:14pm UTC](https://forum.servoy.com/t/javascript-foreach/4696/5 "2005-12-18T23:14:31Z")

</div>

> leemcneil:  
> sed that “foreach” flow statement isn’t present in the Servoy JavaScript.

> AGhisalberti:  
> AFAIK it’s absent even in JavaScript 1.5 (EcmaScript v3).

now IT IS, along with some other new Array metohds.  
Cool the new E4X (ECMA 357), JavaScript XML extension.  
The new JavaScript 1.6 is already embedded in Rhino.

[http://developer.mozilla.org/en/docs/Ne … Script\_1.6](http://developer.mozilla.org/en/docs/New_in_JavaScript_1.6)
