标签:als 字符串 turn log json type str pre 字符
function isJSON(str) { if (typeof str == ‘string‘) { try { var obj=JSON.parse(str); if(typeof obj == ‘object‘ && obj ){ return true; }else{ return false; } } catch(e) { console.log(‘error:‘+str+‘!!!‘+e); return false; } } console.log(‘It is not a string!‘) }
标签:als 字符串 turn log json type str pre 字符
原文地址:https://www.cnblogs.com/smzd/p/9044897.html