Prepend

Copied!
( elems, base )

Description

The Prepend function creates a new array that is the result of combining the elems followed by the base array. This function only works with arrays, not with pages.

Parameters

Argument Type Definition and Requirements

base

The base array.

elems

Value or Array

The elements to add to the beginning of the base array.

Returns

A new array containing both elems followed by the array.

Examples

A new array containing the elems array values, (1, 2, 3), followed by the array values, (4, 5, 6).

Copied!
client.query(
  q.([1, 2, 3], [4, 5, 6])
)
.then((ret) => console.log(ret))
[ 1, 2, 3, 4, 5, 6 ]

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!