Skip to content

Array

Array for storing multiple values in a single variable.

Syntax

To initialize an array, use the [] operator (It more like Go).

nvs

Init array

And you can also to define multiple types of arrays.

nvs

Methods

len

Get the length of the array.

nvs

iter

Iterate the array.

nvs

slice

Get a slice (Same like JavaScript) of the array.

nvs

clear

Remove all items from the array.

nvs

reverse

Reverse the array.

nvs

push

Push an item to the end of the array.

nvs

pop

Pop an item from the end of the array.

nvs

shift

Insert an item to the beginning of the array.

nvs

unshift

Remove an item from the beginning of the array.

nvs

remove

Remove an item from the array, and return the removed item.

nvs

get

Get an item at the given index.

nvs

set

Set an item in the array.

nvs

iter

Create a Iterator for the array.

nvs

clone

Returns a copy of the array.

nvs

Methods for [number]

sum

Get the sum of the array.

nvs

avg

Get the average of the array.

nvs

min

Get the minimum value of the array.

nvs

max

Get the maximum value of the array.

nvs

avg

Get the average of the array.

nvs

sort

Sort the array.

nvs

Methods for [string]

join

Join the array with the given separator.

nvs