Most JavaScript code is also syntactically valid ActionScript 3.0 code. However, there are some exceptions which leads me to my question:
Which constructs/features in JavaScript are syntactically invalid in ActionScript 3.0? Please provide concrete examples of JavaScript code (basic JavaScript code without DOM API usage) that is NOT valid ActionScript 3.0 code.
You can declare a variable in JS without using the
varstatement. In ActionScript 3 thevarstatement is always required.The following is valid JS but will throw a compiler error in AS3:
You can also redeclare a variable in a single scope JS without an error:
In AS3, you can only declare a variable once for each scope.