.insert(location,val)

Description

Insert is a method that puts a value into an array at a location

Parameters

Insert takes the location to insert a value and the value to insert as parameters.

Usage On Arrays

arr = ["wow"]
// setup the array

log arr.insert(1,"hello world")
// returns ["hello world","wow"]
// "hello world" was inserted at index one

Last updated

Was this helpful?