hiding the __proto__ property in Chrome's console

Redefine console.log:

console.log = function (arg) {
    var tempObj;

    if (typeof arg === 'object' && !arg.length) {
        tempObj = JSON.parse(JSON.stringify(arg));
        tempObj.__proto__ = null;
        return tempObj;
    }

    return arg;
};

This won't modify the original object which definitely needs to have __proto__.


console.debug = function() {
  function clear(o) {

    var obj = JSON.parse(JSON.stringify(o));
    // [!] clone

    if (obj && typeof obj === 'object') {
        obj.__proto__ = null;
        // clear

        for (var j in obj) {
          obj[j] = clear(obj[j]); // recursive
        }
    }
    return obj;
  }
  for (var i = 0, args = Array.prototype.slice.call(arguments, 0); i < args.length; i++) {
    args[i] = clear(args[i]);
  }
  console.log.apply(console, args);
};

var mixed = [1, [2, 3, 4], {'a': [5, {'b': 6, c: '7'}]}, [null], null, NaN, Infinity];
console.debug(mixed);