Check out example codes for "kotlin add element to array". It will help you in understanding the concepts better.

Code Example 1

val list: MutableList<String> = ArrayList()
list.add(3, "Hello")
// Adds Hello as the third item in list

list.add("Goodbye")
// Adds Goodbye to the end of list

Learn ReactJs, React Native from akashmittal.com