YUI recommends YUI3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

This documentation is no longer maintained.

YUI Library Examples: YAHOO Global Object: Type-Checking Your Data

YAHOO Global Object: Type-Checking Your Data

The Yahoo Global Object includes several useful type-checking methods in the YAHOO.lang object. Click the Check button in each row to evaluate the data.

Data isObject isArray isFunction
null
[] or new Array()
{} or new Object()
function Foo() {}
new Foo()
elem.getElementsByTagName('p')
YAHOO.util.Dom. getElementsByClassName(
'foo','p',elem)

YAHOO.lang comes with YAHOO

YAHOO.lang comes bundled with the YAHOO Global Object.

If you are using any other YUI components on your page, you should already have YAHOO.lang available.

Checking types

In this example, we use a few of the type-checking methods available in YAHOO.lang to test various types of data.

Other type checking methods

YAHOO.lang currently supports the following type checking methods:

Copyright © 2013 Yahoo! Inc. All rights reserved.

Privacy Policy - Copyright Policy - Job Openings