Skip to content

Instantly share code, notes, and snippets.

@mattbasta
Created December 1, 2014 03:25
Show Gist options
  • Save mattbasta/1d51ec8be17102b61073 to your computer and use it in GitHub Desktop.
Save mattbasta/1d51ec8be17102b61073 to your computer and use it in GitHub Desktop.
fix for every problem ever.js
// Today:
var some_object = {'error': 'hey'};
console.error('oh no blah blah ' + some_object);
// prints: oh no blah blah [object Object]
// But then debug:
Object.prototype.valueOf = function() {return JSON.stringify(this);};
// then later
var some_object = {'error': 'hey'};
console.error('oh no blah blah ' + some_object);
// prints: oh no blah blah {"error": "hey"}
// thank me laterrrrr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment