Assignment
Assignment statements modify the value of existing variables or properties within objects and arrays. The assignment target can include property access and indexing operations to modify nested data structures.
Assignment = AssignmentTarget "=" Expression ;
AssignmentTarget = Identifier { ( "." Identifier | "[" Expression "]" ) } ;
Assignment operations evaluate the right-hand expression completely before storing the result in the specified target location. Chained property access and array indexing allow modification of deeply nested data structures in a single statement.
Valid Syntax:
counter = 5
user.name = "John"
items[0] = "first"
config["timeout"] = 30
nested.data[key] = value
Notes
- Assignment targets support property access and indexing
- Chained property/index access is permitted
- Assignment is not an expression and cannot be used within other expressions