Skip to main content

Add-to-Array-Begin

Command Description

Add to Array's head and Return it

Command Prototype

arrRet = Unshift(array,item)

Parameter Description

ParameterRequiredTypeDefaultDescription
arrayTrueexpression[]The array to be appended
itemTrueexpression""The element to prepend to the array

return

arrRet,The variable used to save the output of the command.

Demo

TracePrint("----------------------Add elements to the head of the array------------------- -----") 
//-------------------------------------------------------------------------------
//[Remarks] Add elements to the head of the array and return the array.
//Input parameter 1:
// array--Array to add elements to.
//Input parameter 2:
// item--The element to add to the array.
//out parameters:
// arrRet--The variable to which the output of the function call is saved.
//
//Command prototype: arrRet=Unshift(array, item)
//-------------------------------------------------------------------------------
arrRet=Unshift(["b","c"],"a")
TracePrint(arrRet)