Skip to content

Instantly share code, notes, and snippets.

@jeffreyiacono
Created November 29, 2012 07:38
Show Gist options
  • Select an option

  • Save jeffreyiacono/4167410 to your computer and use it in GitHub Desktop.

Select an option

Save jeffreyiacono/4167410 to your computer and use it in GitHub Desktop.
define a log property on the window (or global) obj in js
// via https://gist.github.com/4080907
Object.defineProperty(window, 'log', {
set: function(args) {
console.log.apply(console, Array.isArray(args) ? args : [args]);
this.value = args
},
get: function() {
return this.value + " from .get";
}
});
log = 'abc';​​​​​
log = [1,2,3,4];
console.log(​log);​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment