Skip to content

Latest commit

 

History

History
123 lines (82 loc) · 2.09 KB

API_REFERENCE.md

File metadata and controls

123 lines (82 loc) · 2.09 KB

API Reference

Table of contents

Number

Constructor

isNumber(value)

Returns true if value is a number.

Number.isNumber(3) === true;

range(start[, stop, step])

Returns a sequence of numbers, starting from 0 by default, and increments by 1 by default, and ends at a specified number.

range(6); /** [0, 1, 2, 3, 4, 5] */
range(0, 3); /** [0, 1, 2] */
range(1, 5, 2); /** [1, 3] */

Prototype

divFloor(divisor)

Floored integer division.

(8).divFloor(3) === 2;

divModFloor(divisor)

Simultaneous floored integer division and modulus. Returns [quotient, remainder].

(8).divModFloor(3); /** [2, 2] */

divRem(divisor)

Simultaneous truncated integer division and modulus. Returns [quotient, remainder].

(8).divRem(3); /** [2, 2] */

gcd(divisor)

Greatest Common Divisor (GCD).

(6).gcd(8) === 2;

isBetween(min, max)

Returns true if the number is between min (inclusive) and max (exclusive).

(8).isBetween(0, 9) === true;

isEven()

Returns true if the number is even.

(3).isEven() === false;

isMultipleOf(other)

Returns true if other is multiple of self.

(9).isMultipleOf(3) === true;

isOdd()

Returns true if the number is odd.

(3).isOdd() === true;

lcm(divisor)

Lowest Common Multiple (LCM).

(7).lcm(3) === 21;

modFloor(divisor)

Floored integer modulo.

(8).modFLoor(3) === 2;