Skip to main content

JavaScript function to determine if the specified value is undefined or null.

/**
 * Determine if the specified value is undefined or null.
 *
 * @param {*} val The value to check.
 * @return {boolean} Returns true if the value is undefined or null, otherwise false.
 */
function isUndefinedOrNull(val) {
    return typeof val === "undefined" || val === null;
}