一:js面向对象编程
在es5中我们是这样去写面向对象的编程方式的:
function Person(name) {
//构造函数里面的方法和属性
this._name = name;
this.getName = function () {
console.log(this._name);
};
this.setName = function (name) {
this._name = name;
};
}
let p = new Person("张三");
p.getName(); // 张三
p.setName("李四");
p.getName(); // 李四
function Person(