How can I remove an element from the array which was pushed in with push?
animals = []
class Cat
cat = new Cat
animals.push cat
now can I say something like
animals.pull cat
to take the cat away from the array? Presuming that the cat variable is the same one that was pushed inside. I am just trying to create a kind of a dynamic collection..
If you
pushan element to an array, it’s added at the last position. You can thenpopit back. These two methods are useful if you want to model a stack with an array.