Skip to content

Sys.TypeOf

boxgaming edited this page Jul 11, 2026 · 2 revisions

Returns a string indicating the type of the specified variable's value.
Available in release 0.11.0

QBJS leverages the underlying flexible typing of JavaScript. This method will return the actual Javascript type of the passed variable, even if it has been set to a value type that does not match the declared type.

Syntax

typeName$ = Sys.TypeOf ( variable )

Parameters

  • The className$ parameter specifies the name of the native JavaScript type to create.
  • Optional arg parameters will be passed to constructor in the order listed.

Example

Import Sys From "lib/lang/system.bas"

Dim myVar
myVar = 23.4
Print Sys.TypeOf(myVar); " - "; myVar
myVar = "twenty-three point four"
Print Sys.TypeOf(myVar); " - "; myVar
myVar = true
Print Sys.TypeOf(myVar); " - "; myVar

Dim o As Object
o.name = "Fred"
o.age = 23
Print "o:      "; Sys.TypeOf(o)
Print "o.name: "; Sys.TypeOf(o.name)
Print "o.age:  "; Sys.TypeOf(o.age)
Print "o.fake: "; Sys.TypeOf(o.fake)

Output

number - 23.4
string - twenty-three point four
boolean - true
o:      object
o.name: string
o.age:  number
o.fake: undefined

See Also

Sys.Construct
JavaScript - typeof

Clone this wiki locally