Cannot use "for-of" syntax and "forEach"

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
SolidBlock
Posts: 4
Joined: December 16th, 2021, 6:07 am
Location: Shanghai

If I use `for-of` syntax in my script, the IDE identifies it correctly, but AE thinks it as a syntax error.
Also, if I use `forEach` with lambda instead, AE says "> has no value". If I use `forEach` with anonymous function syntax, AE says "forEach is undefined".

Also, I cannot use `includes`, which is a method in `Array`.
So what syntax should I use instead?

User avatar
zlovatt
Posts: 47
Joined: October 31st, 2016, 5:00 pm
Location: Portland
Contact:

Extendscript is a version of Javascript from 1999, and so you're limited to the features available in ECMA3.

What you'll need to use is a for loop:

Code: Select all

for (var i = 0; i < items.length; i++) {
  var item = items[i];
  ...
}
Post Reply