func.toString = function(){ return 'lol' }; o = { a: 42, b: 'foo', toString: function(){ return 'lol' } }; but that only works for == =()