Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Whoops, some type strings are typeof()-only

...

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
languagejavascript
themeConfluence
nums = [1, 2, 3]
nums_type = nums.typeof() // nums_type = "Array"

...