js-fns
Version:
Modern JavaScript utility library focused on the build size
15 lines (14 loc) • 308 B
JavaScript
/**
* Creates an array without the given element.
*
* @param array - The array to remove the element from
* @param element - The element to remove
*
* @category Array
* @public
*/
export default function remove(array, element) {
return array.filter(function (el) {
return el !== element
})
}