typeid Summary Returns the type of an expression at runtime. Syntax typeid expression Parameters expression Any valid expression. Description typeid returns the type of an expression at runtime. typeid is an improved and fixed typeof operator that is compatible with JS++ types. (JS++ inherited from typeof from JavaScript.) For JS++ Types For JS++ types, typeid will return the exact type for an expression. Additionally, typeid will return accurate numeric types; for example, 1 + 1 will return "int", whereas typeof will return "number". Likewise, for objects, the class type will be returned. When auto-boxing, if the wrapper class is declared as the type for a variable, the wrapper class type will be returned for typeid: 12System.Boolean b = true;typeid b; // "System.Boolean" For JavaScript Types Unlike JavaScript's typeof operator, the JS++ typeid operator includes fixes, such as typeid null returning "void" instead of "object". The following table describes the values for typeid on external JavaScript values: Type Value Global object external<global> boolean external<boolean> string external<string> number external<number> NaN external<number NaN> Infinity external<number Infinity> function external<Function> Arrays external<Array> Objects ({ ... }) external<Object> null external<void> undefined external<void> Host objects external<object ...> Examples typeid on internal types 1234567import System; int x;string s; Console.log(typeid x); // "int"Console.log(typeid s); // "string" typeid on external types 12345678import System;import Externals.DOM; var a = [ 1, 2, 3 ];var b = document.createElement("div"); Console.log(typeid x); // "external<Array>"Console.log(typeid s); // "external<object HTMLDivElement>" See Also Types Share HTML | BBCode | Direct Link