The YUI Global Object: Check Data Types with Lang
The YUI Global Object
includes several useful type-checking methods in the Lang
object. In addition to the 'isXYZ' type check methods, YUI3 includes
Y.Lang.type, which returns a string represting the type of the tested
object. Click the "Check" button in each row to evaluate the data.
| Data | isObject | isArray | isFunction | type |
|---|---|---|---|---|
null |
||||
[] or new Array() |
||||
{} or new Object() |
||||
function Foo() {} |
||||
new Foo() |
||||
Type Checking with YUI
Instantiate YUI
Checking types
In this example, we use a few of the type-checking methods available in
Lang to test various types of data.
