Complete the code to add a new element to the end of the array.
var fruits = ["Apple", "Banana"] fruits.[1]("Orange")
The append method adds a new element to the end of the array.
Complete the code to insert an element at the start of the array.
var numbers = [2, 3, 4] numbers.[1](1, at: 0)
The insert(_:at:) method inserts an element at a specified position in the array.
Complete the code to remove the element "Banana" from the array.
var fruits = ["Apple", "Banana", "Cherry"] fruits.[1](at: 1)
The remove(at:) method removes an element at a specified index in the array. Here, index 1 corresponds to "Banana".
Fill both blanks to insert "Grape" at index 2 and then remove the element at index 0.
var fruits = ["Apple", "Banana", "Cherry"] fruits.[1]("Grape", at: 2) fruits.[2](at: 0)
Use insert(_:at:) to add an element at a specific index and remove(at:) to remove an element at a specific index.
Fill all three blanks to append "Kiwi", insert "Mango" at index 1, and remove the last element.
var fruits = ["Apple", "Banana"] fruits.[1]("Kiwi") fruits.[2]("Mango", at: 1) fruits.[3]()
append adds an element at the end, insert(_:at:) inserts at a specific index, and popLast() removes the last element.