pub enum Const {
String(Box<str>),
Num(f64),
Int(i32),
BigInt(JsBigInt),
Bool(bool),
Null,
Undefined,
}
Expand description
Literals represent values in JavaScript.
These are fixed values not variables that you literally provide in your script.
More information:
Variants
String(Box<str>)
A string literal is zero or more characters enclosed in double ("
) or single ('
) quotation marks.
A string must be delimited by quotation marks of the same type (that is, either both single quotation marks, or both double quotation marks). You can call any of the String object’s methods on a string literal value. JavaScript automatically converts the string literal to a temporary String object, calls the method, then discards the temporary String object.
More information:
Num(f64)
A floating-point number literal.
The exponent part is an “e
” or “E
” followed by an integer, which can be signed (preceded by “+
” or “-
”).
A floating-point literal must have at least one digit, and either a decimal point or “e
” (or “E
”).
More information:
Int(i32)
Integer types can be expressed in decimal (base 10), hexadecimal (base 16), octal (base 8) and binary (base 2).
More information:
BigInt(JsBigInt)
BigInt provides a way to represent whole numbers larger than the largest number JavaScript
can reliably represent with the Number
primitive.
More information:
Bool(bool)
The Boolean type has two literal values: true
and false
.
The Boolean object is a wrapper around the primitive Boolean data type.
More information:
Null
In JavaScript, null
is marked as one of the primitive values, cause it’s behaviour is seemingly primitive.
In computer science, a null value represents a reference that points, generally intentionally, to a nonexistent or invalid object or address. The meaning of a null reference varies among language implementations.
More information:
Undefined
The undefined
is a primitive value automatically assigned to variables that have just been declared, or to formal arguments for which there are no actual arguments.
More information: