Skip to content
Hyomoto edited this page Dec 12, 2020 · 16 revisions
Jump To Go Back Arguments Methods Variables

Array( array/size, default )

Implements: None

A wrapper for primitive arrays and an interface for building more complex ones.

 array = new Array( 10, 0 );

 array = new Array( [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] );

Arguments

Name Type Purpose
array/size undef {mixed} Either the starting array to use, or the size of the array to create.
default undef {mixed} optional: if provided, will fill the newly created array. Default: undefined

Methods

Jump To top sort unique concat difference union contains set get resize
toArray toString is

sort()

Returns: N/A undefined

Name Type Purpose
None

Used as a template interface for constructors that inherit Array


unique()

Returns: N/A undefined

Name Type Purpose
None

Returns an array containing all of the unique elements in the array.


concat( target )

Returns: array ([values...])

Name Type Purpose
target array The array to combine

Returns an array containing all the elements from both arrays..


difference( target )

Returns: array ([values...])

Name Type Purpose
target array The array to subtract

Returns an array containing every element not in the provided array.


union( target )

Returns: array ([values...])

Name Type Purpose
target array The array to union with

Returns an array containing all of the unique elements between both arrays.


contains( value )

Returns: int (0..)

Name Type Purpose
value mixed The value to search for

Return the first index which contains value, or -1 if it wasn't found.


set( index, value )

Returns: value

Name Type Purpose
index int The index to set
value mixed The value to assign

Used to set an element in the array.


get( index )

Returns: Mixed

Name Type Purpose
index int The index to retrieve

Used to get an element from the array.


resize( size, default )

Returns: N/A undefined

Name Type Purpose
size int The new size for the array
default mixed optional: the value the array any new elements will be populated with. Default is undefined

toArray()

Returns: array ([values...])

Name Type Purpose
None

Returns the structure as a array.


toString( divider )

Returns: string ("string")

Name Type Purpose
divider string optional: The divider between each element. Default: ", "

Returns a comma-separated string(by default) of all values in the array.


is( type )

Returns: boolean (true or false)

Name Type Purpose
type Constructor The Constructor to compare this against.

Returns true if the provided type is Array.


Variables

Jump To top
  • content - The internal array.
Clone this wiki locally