Array.unshift

Array.unshift

Array.unshift

Function

Insert one or more elements into the beginning of the array.

Syntax

Parameters

ParametersTypeRequiredDefault valueDescription
valueNAnyNoNoneThe element to insert.

Return value

TypeDescription
ArrayReturns the original array object.

Example

Notes

  • This method will modify the original array.