The closest I got to something close to Python's repr is this:
function User(name, password){
this.name = name;
this.password = password;
}
User.prototype.toString = function(){
return this.name;
};
var user = new User('example', 'password');
console.log(user.toString()) // but user.name would be even shorter
Is there a way to represent an object as a string by default? Or am I going to have to just use object.variable to get the results I want?
JSON.stringify is probably the closest you are going to get from native libraries. It doesn't work well with objects, but you could define your own code to work around that. I searched for libraries that provide this functionality but didn't find anything.
String(user)
Is the best I can think of. I think another alternative may be to find a 3rd party lib that handles creating human readable presentation for objects.