Methods
addFruitToEnd(fruits, fruit) → {Array.<string>}
Appends a fruit to an array of fruits and returns the array.
Parameters:
Name | Type | Description |
---|---|---|
fruits |
Array.<string> | |
fruit |
string |
- Source:
Returns:
- Type
- Array.<string>
addFruitToFront(fruits, fruit) → {Array.<string>}
Adds a fruit to the front of an array of fruits and returns the array.
Parameters:
Name | Type | Description |
---|---|---|
fruits |
Array.<string> | |
fruit |
string |
- Source:
Returns:
- Type
- Array.<string>
arrayLength(array) → {number}
Takes in an array and returns the length
Parameters:
Name | Type | Description |
---|---|---|
array |
Array |
- Source:
Returns:
- Type
- number
arrayToString(fruits) → {string}
Returns a string made by joining all of the elements in an array of fruits with a '$' character.
Parameters:
Name | Type | Description |
---|---|---|
fruits |
Array.<string> |
- Source:
Returns:
- Type
- string
firstElementIndexing(array) → {*}
Takes in an array and returns the first element without altering or mutating the array
Parameters:
Name | Type | Description |
---|---|---|
array |
Array |
- Source:
Returns:
- Type
- *
largerArray(array1, array2) → {string|Array}
Takes in two arrays. And returns the longer array.
If the arrays are of the same length return "They are the same size"
Parameters:
Name | Type | Description |
---|---|---|
array1 |
Array | |
array2 |
Array |
- Source:
Returns:
- Type
- string | Array
lastElementIndexing(array) → {*}
Takes in an array and returns the last element without altering or mutating the array
Parameters:
Name | Type | Description |
---|---|---|
array |
Array |
- Source:
Returns:
- Type
- *
middleElement(array) → {*|Array}
Takes in an array and returns the middle element.
If the array is even in length return the middle two elements in their own array.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array |
- Source:
Returns:
- Type
- * | Array
removeFirst(fruits) → {Array.<string>}
Removes the first fruit in an array of fruits and returns the array.
Parameters:
Name | Type | Description |
---|---|---|
fruits |
Array.<string> |
- Source:
Returns:
- Type
- Array.<string>
removeFirstandReturnFirst(fruits) → {string}
Removes and returns the first fruit in an array of fruits.
Parameters:
Name | Type | Description |
---|---|---|
fruits |
Array.<string> |
- Source:
Returns:
The fruit that was removed
- Type
- string
removeLast(fruits) → {Array.<string>}
Removes the last fruit from an array of fruits and returns the array.
Parameters:
Name | Type | Description |
---|---|---|
fruits |
Array.<string> |
- Source:
Returns:
- Type
- Array.<string>
removeLastandReturnLast(fruits) → {string}
Removes and returns the last fruit from from an array of fruits
Parameters:
Name | Type | Description |
---|---|---|
fruits |
Array.<string> |
- Source:
Returns:
The fruit that was removed
- Type
- string