On running the JS code from an AS context, it may well be a sensible transitional stage, but things get a lot easier when you start to call the JS from JS. In particular, if you call from AppleScript, the code
- Needs to be a quoted string
- Shows no syntax highlighting, and
- requires escaping of a various characters, including string quotes.
PS Perhaps one approach might be to start building up a scripting examples page on the Wiki ?