💾arr.removeValue()

removes specific value from array.

/**
 * 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;

💈範例:

Archive

💈範例:

Last updated

Was this helpful?