O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

abs — Return the absolute value of a number

Usage

Lang.abs(num)

num : Number

Description

If num is an integer or can be converted to one, returns a positive integer. Otherwise, if num is a floating-point value or can be converted to one, returns a positive floating-point value.

Examples

Lang.abs(17)

returns integer 17

Lang.abs("-17")

returns integer 17

Lang.abs(2.3)

returns floating-point 2.3

Lang.abs(-2.3)

returns floating-point 2.3

Lang.abs("foo")

returns invalid

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required