.prepend(val)

Description

Pushes val onto the start of the array and returns the array itself (enabling chaining).

Parameters

  • val — value to prepend.

Usage

arr = [1,2]
arr.prepend(0)
log arr // [0,1,2]

Last updated

Was this helpful?