• Checks if the passed value is defined, which means it has any value and is not undefined. A string value of "undefined" is considered to be defined.

    Parameters

    • arg: any

      The value to check

    Returns boolean

    true if arg has a value (is not === undefined)

    isDefined(null);         // false
    isDefined(undefined); // false
    isDefined("undefined"); // true

    let value = null;
    isDefined(value); // false
    let value = undefined;
    isDefined(value); // false

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