Member Reference Operators
|Top Previous Next|
Operators: . [ ]
object . member
object [ string ]
array [ expression ]
string [ expression ]
The expression object is converted to an object according to these rules:
The result of the operator is the member of the object whose name is the identifier member (for .) or whose name is the string string (for ). If the object has no member of that name, the result is undefined. The CellScript Simulator may report a warning in this case, as this is likely a programming error.
Note that the Boolean object has no members and so will always give the result undefined.
 Operator Used with Array or String
The expression is converted to Number if necessary, then truncated to integer. The integer is used as an index into the array or into the characters of the string, where the first element/character is at index zero. The result of the operator is the array element or string character code, or undefined if there is no element corresponding to that index. In the latter case, the CellScript Simulator may also report a warning, as this is likely a programming error.
In the case of String, this is a shorthand for string.charCodeAt(), and it cannot appear on the left-hand side of an assignment.