Answers for "javascript check if string is null or undefined"

9

javascript check if undefined or null

if( typeof myVar === 'undefined' || myVar === null ){
    // myVar is undefined or null
}
Posted by: Guest on October-23-2019
0

javascript validate if string null undefined empty

/**
  * Checks the string if undefined, null, not typeof string, empty or space(s)
  * @param {any} str string to be evaluated
  * @returns {boolean} the evaluated result
*/
function isStringNullOrWhiteSpace(str) {
    return str === undefined || str === null
                             || typeof str !== 'string'
                             || str.match(/^ *$/) !== null;
}
Posted by: Guest on September-30-2021

Code answers related to "javascript check if string is null or undefined"

Code answers related to "Javascript"

Browse Popular Code Answers by Language