The closest I got to something close to Python\'s repr is this:
function User(name, password){
this.name = name;
this.pass
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.
This is solution for NodeJS (not sure about browser). As https://nodejs.org/dist/latest-v8.x/docs/api/util.html#util_util_inspect_object_options says, you could add inspect(depth, opts)
to your class and it will be called when you console.log(user_class_instance);
Therefore this should do the trick:
User.prototype.inspect = function(depth, opts){
return this.name;
};