removeAllInstancesFrom()
Remove all instances of a given value from a String or Number.
Arguments
Required:
_obj: string | number, _valueToRemove: string | number
Note: both must be of same type to work, else it returns _obj.
Returns
(string | number): original string or number with all selected values removed, or _obj if error encountered.
Example
const originalString = "Hello World";
const originalNumber = 1133557799;
const newString = removeAllInstancesFrom(originalString, "l");
// => "Heo Word";
const newNumber = removeAllInstancesFrom(originalNumber, 3);
// => 11557799;