- A、判断变量是否为
''
null
undefined
:if (null == modelType || 'undefined' == typeof(modelType) || '' == modelType) { return; }
- B、
null
undefined
变量转换''
:StringUtil.nullToString = function (str) { if (str === null || typeof str === 'undefined') { return ''; } else { return `${str}`; } }