Learn
Lists
Removing Items from a List
We’re also able to remove items from a list.
Similar to adding items, we can modify lists by taking off the last item, or we can use indexing to select a specific item and remove it from the list.
myList = ['apple', 'banana', 'pear'] myList.pop() // returns 'pear' // now, myList == ['apple', 'banana']
This line of code will take away the last item from our list, keeping our sequence intact. But we can also remove items from the middle of our list:
myList = ['apple', 'banana', 'pear'] myList.splice(1, 1) // returns 'banana' // now, myList == ['apple', 'pear']
Instructions
After looking at your comic strip, you decide that you want the ending to be a cliffhanger. Take off the last frame from the comic.