知道private和public吗
public & private
function People(name){ this.name = name; var sex = "男"; this.setSex=function(){ return sex; } } const p1 = new People("李华"); console.log(p1.name); // 李华 console.log(p1.sex); // undefined console.log(p1.getSex()); // “男”