在构造函数中
    公有属性 一般在原型对象上
    私有属性 通过this关键字去添加的
    hasOwnProperty 可以判断属性是私有的还是公有的

              function Person(name,age){
                this.name = name;
                this.age = age;
            }
            /*
            在构造函数中
            公有属性 一般在原型对象上
            私有属性 通过this关键字去添加的
            hasOwnProperty 可以判断属性是私有的还是公有的
            */
            Person.prototype = {
                constructor:Person,
                sayName:function(){
                    console.log(this.name);
                },
                sayAge(){
                    console.log(this.age);
                }
            }
    
            var p = new Person("chen",20);
            console.log(p.hasOwnProperty("name"));
            console.log(p.hasOwnProperty("sayName"));
            console.log();
    
            var obj = {
                name:"zhang"
            }
            console.log(obj.hasOwnProperty("name"));