Answers for "how do i check if a string is not null in javascript"

1

javascript is not null

if(data !== null && data !== '') {
   // do something
}
Posted by: Guest on June-10-2020
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 "how do i check if a string is not null in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language