Assignment AST JavaScript Object
The Assignment
object matches a JavaScript assignment.
The astType
value for this node is assignment
.
Code Pattern
This AST element captures the following code.
const myVariable = 1;
Attributes
astType
: constant string value ("assignment"
)left
(any type that inheritsAstElement
): the left side of the assignmentright
(any type that inheritsAstElement
): the right side of the assignment
info
To know what is the type of left
or right
, use the astType
to distinguish.
For example, to check if the left node is a string, just use the following code:
if (node.left.astType === "string") {
....
}