比如一个函数
function some(param) { //判断param能否转成json对象 //... return JSON.parse(param); }
怎么判断呢
ringa_lee
try{ a=JSON.parse(param); }catch(e){ alert(e); //error in the above string(in this case,yes)! }
ringa_lee