removeFrom
Removes an item from list
using item or an entry from map
using key
removeFrom(targetList, item)
# Or
removeFrom(targetMap, key)
#
ParameterstargetList
: The targetlist
item
: Alist
item to remove fromtargetList
targetMap
: The targetmap
key
:string
key to remove it's entry fromtargetMap
#
Returns- A boolean indicating the removal. A
false
will be returned if anitem
orkey
wasn't found intargetList
ortargetMap
#
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}