Arrays.clearNull()
Syntax
function clearNull<T>(array: T[]): T[]
Removes all null
or undefined
elements from the array.
Parameters | |
array
|
The array you want to clear of |
Example
import { Arrays } from 'potence';
const array = [5, undefined, 2, null];
Arrays.clearNull(array);
console.log(array); // -> [5, 2]
Remarks
This function returns the original array, not a new one.