Function isNullOrUndefined

  • Checks if the provided value is null, undefined or contains the string value of "undefined".

    Parameters

    • value: any

      The value to check

    Returns boolean

    true if the value is null or undefined

    isNullOrUndefined(null);         // true
    isNullOrUndefined(undefined); // true
    isNullOrUndefined("undefined"); // true

    let value = null;
    isNullOrUndefined(value); // true
    let value = undefined;
    isNullOrUndefined(value); // true

    isNullOrUndefined(""); // false
    isNullOrUndefined(0); // false
    isNullOrUndefined(new Date()); // false
    isNullOrUndefined(true); // false
    isNullOrUndefined(false); // false