Skip to main content

removeFrom

Removes an item from list using item or an entry from map using key

removeFrom(targetList, item)
# Or
removeFrom(targetMap, key)

Parameters#

  • targetList: The target list
  • item: A list item to remove from targetList
  • targetMap: The target map
  • key: string key to remove it's entry from targetMap

Returns#

  • A boolean indicating the removal. A false will be returned if an item or key wasn't found in targetList or targetMap

Example#

# Remove an item from listfruits = ['apple', 'banana', 'orange']removeFrom(fruits, 'apple')print(fruits) # prints [banana, orange]
# Remove by key from mapproduct = {  name: 'iPhone',  model: '8',  price: 600}removeFrom(product, 'model')print(product) # prints {name: iPhone, price: 600}