isJSON(data){
try{
if(typeOf JSON.parse(data)=='object'){
return true
}
}catch(e){
return false
}
},
由于如果是字符串的话 typeof JSON.parse(data)=='object' 会报错,所以用try catch,抛错的就是字符串
isJSON(data){
try{
if(typeOf JSON.parse(data)=='object'){
return true
}
}catch(e){
return false
}
},
由于如果是字符串的话 typeof JSON.parse(data)=='object' 会报错,所以用try catch,抛错的就是字符串