💾arr.removeValue()
/**
* remove specific `value` from the array.
* @example
* import array_removeValue from './.../array_removeValue.mjs';
* Object.assign(Array.prototype, array_removeValue);
* @mixin
*/
const array_removeValue = {
/**
* remove specific `value` from the array.
* @example
* const arr = [1, 2, 1, 3, 1, 4]
* arr.removeValue(1) // [ 2, 3, 4 ]
* @param value {*} the value to be removed
*/
removeValue(value) {
return this.filter(x => x !== value);
},
};
export default array_removeValue;💈範例:
arr.filter() - remove undefined, nullish, holes, ... from array.
Archive
replit ⟩ array ⟩ removeAll()
💈範例:
Last updated
Was this helpful?