Sintaks JavaScript untuk periksa nol atau tidak ditentukan atau kosong
if (typeof value !== 'undefined' && value) {
//deal with value'
};
Different Dugong
if (typeof value !== 'undefined' && value) {
//deal with value'
};
/**
* 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;
}