Skip to content

Instantly share code, notes, and snippets.

@NHQ
Created January 4, 2012 20:38
Show Gist options
  • Select an option

  • Save NHQ/1562012 to your computer and use it in GitHub Desktop.

Select an option

Save NHQ/1562012 to your computer and use it in GitHub Desktop.
Object prototype
> Object.prototype.toJSON = function(){return JSON.stringify(this)};
> obj = {a:1};
> obj.toJSON();
// RangeError: Maximum call stack size exceeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment