.removeLast()

Christine_Yang265 total contributions
Published Oct 11, 2022
Contribute to Docs
The .removeLast()
method removes the last element in an array.
Syntax
arrayName.removeLast()
Example
var topBabyNames = ["Sophia", "Liam", "Riley", "Jackson", "Olivia", "Noah"]topBabyNames.removeLast()print(topBabyNames)
This will output:
["Sophia", "Liam", "Riley", "Jackson", "Olivia"]
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.