Nodejs Array Dump dump()

Here you can find the source of dump()

Method Source Code

Array.prototype.dump = function(){
   var output = new Array();
   var number = 0;
   output.push('<tr><th>#</th><th>Key</th><th>Value</th></tr>');
   for(var i in this){
      if(typeof eval(this.get(i)) != 'function'){
         output.push('<tr><td>' + number + '</td><td>' + i + '</td><td>' + this.get(i) + '</td></tr>');
         number++;/*from  ww  w.j  av  a 2  s .  c  o  m*/
      }
   }
   return 'Array dump: <table>' + String.fromCharCode(10) + output.join(String.fromCharCode(10)) + String.fromCharCode(10) + '</table>';
}

Related

  1. dump()
    Array.prototype.dump = function () {
        for (var element in this) {
            print(element, this[element]);
    };
    var custom = ['1', 2, "three"];
    custom.dumper = function () {
        print("something");
    };
    ...