function createPerson(name,age,sex){

    var person = new Object();

    person.name = name;
    person.age = age;
    person.sex = sex;
    person.sayHi = function(){

        console.log("hello");
    };

    return person;
    
}
    var p1 = createPerson("张三",41,true);

    var p2 = createPerson("李四",20,false);

    console.log(p1);

    console.log(p2);



2023-07-02T15:11:57.png