Posted in Javascript onJune 09, 2014
function dealNull(obj){ for(var i in obj){ if(null == obj[i] || 'null' == obj[i]){ obj[i]=''; }else if('object' == typeof obj[i]){ dealNull(obj[i]); } } }; // 测试的对象 var a={}; a.aa=null; a.bb='null'; a.c=1; a.b={}; a.b.aaa=null; a.b.bbb='null'; a.b.c=1; a.array=[]; a.array.push({'a':null,'b':'null','c':1}); a.array.push({'a1':null,'b1':'null','c1':1}); a.array.push({'a2':null,'b2':'null','c2':1}); dealNull(a);
javascript 处理null及null值示例
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@