This is probably gonna be a duplicate, but since I haven't found anything related by quick search, I'll post it and eventually delete it.
I'm a beginner in JavaScript classes and constructors and I'm having issues in logging the exact type of an object. My scripts are:
class User{
    constructor(name, surname){
        this.name= name;
        this.surname= surname;
    }
}  
Then in the second script:
    class Room{
    constructor(){
        this.array=[];
    }
    add(user){
        this.array.push(user);
    }
    find(user){
        var value;
        for(var i in this.array){
            if(this.array[i].name== user){
                value= user;
            }
        }
        console.log(value);
    }
}
var m= new Room();
var mark= new User("Mark", "M");
var joe= new User("Joe", "J");
var sam= new User("Sam", "S");
var nil= new User("Nil", "N");
m.add(mark);
m.add(joe);
m.add(sam);
m.add(nil);
Then I'm expecting a console.log(mark) to print 
User { name: "Mark", surname: "M" }
but the type seems to always be Object. Same happens if I log m, the Room-expected object, anyone can help?
 
    