.append(val)
Description
Append is a simple method that returns the input value you give it, but with a new value attached to the end.
Parameters
Append takes only one parameter, and will treat multiple parameters as one parameter
Usage On Arrays
arr = ["wow"]
// setup the array
arr.append("hello world")
// i use a method as a command so that it updates the variable
// append adds the new value as the first item in the array
log arr
// returns ["wow","hello world"]
Usage On Strings
str = "hello "
// setup the string
str.append("world")
// update the variable and append the value to the end of the string
log str
// returns "hello world"
Last updated
Was this helpful?