typeof
Function
typeof — the type of a value
Synopsis
typeof(val: any) -> type
Description
The typeof function returns the type of
its argument val
. Types are first class so the returned type is
also a value. The type of a type is type type
.
Examples
The types of various values:
yield typeof(this)
1
"foo"
10.0.0.1
[1,2,3]
{s:"foo"}
null
error("missing")
Loading...
echo '1
"foo"
10.0.0.1
[1,2,3]
{s:"foo"}
null
error("missing")' \
| super -z -c 'yield typeof(this)' -
The type of a type is type type
:
yield typeof(typeof(this))
null
Loading...
echo 'null' \
| super -z -c 'yield typeof(typeof(this))' -