SOURCE

// function createPerson(name, age, job) {
//     let o = new Object();
//     o.name = name;
//     o.age = age;
//     o.job = job;
//     o.sayName = function () {
//         console.log(this.name);
//     };
//     return o;
// }
// let person1 = createPerson("das", 23, "dasdasda");
// console.log(typeof person1);
// console.log(person1 instanceof Object);
// console.log(person1 instanceof createPerson);

// function ReturnVariable() {
//     let x = 100;
//     this.info = function () {
//         console.log(`this x: ${this.x}, Private x: ${x}`);
//     }
//     // return 200; // 当返回值为基本数据类型, 不影响构造函数
//     return { x: 200 } // 当返回值为对象数据类型, 则示例为这个返回值
// }

// let returnVar = new ReturnVariable;
// console.log(returnVar);

// function Person(name, age, job) {
//     this.name = name;
//     this.age = age;
//     this.job = job;
//     this.sayName = function () {
//         console.log(this.name);
//     };
// }
// Person.prototype = { a: '13' };
// let person2 = new Person("dasda", 22, "dasdassdad");
// console.log(typeof person2);
// console.log(person2 instanceof Object);
// console.log(person2 instanceof Person);
// console.log(person2.constructor);
// console.log(person2.a);
// console.log(person2.constructor == Person);

// let biped = {
//     numLegs: 2
// };
// let man = Object.create(biped);
// man.name = 'das';

// console.log(man.name);
// console.log(man.numLegs);
// console.log(Object.getPrototypeOf(man) === biped);

// function Man1() {};
// Man1.prototype.name = "NInini";
// Man1.prototype.age = 29;
// Man1.prototype.job = "dslsll";
// Man1.prototype.sayName = function() {
//     connsole.log(this.name);
// };

// let man1 = new Man1();
// let man2 = new Man1();

// man1.name = "Greg";
// console.log(man1.hasOwnProperty("name"));
// console.log(man1.name);
// console.log(man2.name);
// console.log(man2.sayName);
// delete man1.name;
// console.log(man1.name);

function Person6() {};

Person6.prototype.name = "NIiiD";
Person6.prototype.age == 29;
Person6.prototype.job = "Softmess da";
Person6.prototype.sayName = function() {
    console.log(this.name);
};

let person5 = new Person6();
// let person6 = new Person6();

console.log(person5.hasOwnProperty("name"));
console.log("name" in person5);
console 命令行工具 X clear

                    
>
console