标签:not type func console log err typeof else return
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!‘)
}
标签:not type func console log err typeof else return
原文地址:https://www.cnblogs.com/gynStrive/p/10277115.html