...
The as()
operators coerces objects of one type to be an object of another. The target type is given as a string argument to the operator. The following types are available:
"Array"
"Boolean""Map"
"Null"
"Number"
"RegExp"
"String"
The following coercions are valid:
...
The typeof()
operator returns the type of the object to which it is applied. The return value is one of the strings that may be passed to as()
. , or one of the other following values:
"Array"
"Map"
"Null"
For example:
Code Block | ||||
---|---|---|---|---|
| ||||
nums = [1, 2, 3] nums_type = nums.typeof() // nums_type = "Array" |
...