Class: Number

Number()

new Number()

Add some methods to standerd JavaScript object.

Methods

clamp(min, max) → {Number}

Returns a number whose value is limited to the given range.
Parameters:
Name Type Description
min Number The lower boundary
max Number The upper boundary
Returns:
A number in the range (min, max)
Type
Number

mod(n) → {Number}

Returns a modulo value which is always positive.
Parameters:
Name Type Description
n Number The divisor
Returns:
A modulo value
Type
Number

padZero(length) → {String}

Makes a number string with leading zeros.
Parameters:
Name Type Description
length Number The length of the output string
Returns:
A string with leading zeros
Type
String