Copy link to clipboard
Copied
So, a script I was developing was working fine yesterday, but today, it seems like my Array built-in object is broken. I tried restarting After Effects to reset the environment, but it's still broken. So far, I've identified that "map", "includes", and "split" are broken, though "shift" is fine. I don't have any custom startup scripts.
I've attached a simple .txt file that demonstrates this error for me, though I'm guessing it would work normally. Just rename it to .jsx and run it yourself.
OS: MacOS Big Sur v11.4
AE: v18.4.0 build 41
Copy link to clipboard
Copied
EDIT:
Whoops, "split" is a string function, it won't work anyway, ahahah.
Still, "map" and "includes" are both broken for me.
Copy link to clipboard
Copied
In general, you cannot expect Ae scripting to support all features of modern JavaScript.
After Effects scripting is using ExtendScript and ExtendScript implements the JavaScript language according to the ECMA-262 specification. This is a very old variant of JavaScript and it does not include features like Array.map, yet.
Copy link to clipboard
Copied
The worst difference I found so far is actually this one:
true || true && false
evaluates to "false" in After Effects ExtendScript, but to "true" in modern JavaScript.
Because After Effects reads it as
(true || true) && false
whereas modern JavaScript reads it as
true || (true && false)
So when writing logic statements, make sure to always set parenthesis to avoid trouble. And don't use minifiers like uglify.js which remove these parenthesis.