YUI 3.x Home -

YUI Library Examples: DataType Utility: DataType.Number.parse()

Note: This is YUI 3.x. Looking for YUI 2.x?

DataType Utility: DataType.Number.parse()

The Number module of the DataType Utility allows you to take a data value and convert it to a number.

To convert a data value to a number, simply call the parse() function of the DataType.Number class:

Under the hood, the data value is converted to a number via +data, not parseInt(). When the resulting value is NaN, then null is returned:

Copyright © 2009 Yahoo! Inc. All rights reserved.

Privacy Policy - Terms of Service - Copyright Policy - Job Openings