新普京网站-澳门新普京 > 新普京网站 > 用nodejs实现PHP的print_r函数代码

用nodejs实现PHP的print_r函数代码

2019/12/30 04:02

复制代码 代码如下:function ergodic{ var indent = " " + indentation; if(obj.constructor == Array || obj.constructor == Object卡塔尔{ for{ if(obj[p].constructor == Array|| obj[p].constructor == Object){ console.log(indent + "["+p+"] => "+typeof; console.log; ergodic; console.log; } else if (obj[p].constructor == String) { console.log(indent + "["+p+"] => '"+obj[p]+"'"); } else { console.log(indent + "["+p+"] => "+obj[p]+""); } } }}function print_r { console.log; console.log}var stu = {'name':'Alan','grade':{'Chinese':120,'math':130,'competition':{'NOI':'First prize'}}};print_r;

 代码如下: function ergodic(obj,indentation卡塔尔(قطر‎{   var indent = "  " + indentation;   if(obj.constructor == Array || obj.constructor == Object卡塔尔{       for(var p in objState of Qatar{       if(obj[p].constructor == Array|| obj[p].constructor == Object){         console.log(indent + "["+p+"] => "+typeof(obj)+"");         console.log(indent + "{");         ergodic(obj[p], indent);         console.log(indent + "}");       } else if (obj[p].constructor == String) {         console.log(indent + "["+p+"] => '"+obj[p]+"'");       } else {         console.log(indent + "["+p+"] => "+obj[p]+"");       }     }   } }   function print_r(obj) {   console.log("{")   ergodic(obj, "");   console.log("}") }   var stu = {'name':'Alan','grade':{'Chinese':120,'math':130,'competition':{'NOI':'First prize'}}};   print_r(stu);  

代码如下:function ergodic(obj,indentationState of Qatar{ var indent = + indentation; if(ob...

上一篇:jquery插件开发之实现google 下一篇:运用JQuery的toggle实现网页加载完成自动弹窗_jquery_脚本之家