# 外观模式 外观模式(Facade Pattern)隐藏系统的复杂性,并向客户端提供了一个客户端可以访问系统的接口。这种类型的设计模式属于结构型模式,它向现有的系统添加一个接口,来隐藏系统的复杂性。 # 示例 ```js function Student(name, province, city, area){ this.name = name; this.province = province; this.city = city; this.area = area; this.getName = function(){ return this.name } this.getProvince = function () { return this.province } this.getCity = function () { return this.city } this.getArea = function () { return this.area } // 外观接口 this.getInfo = function(){ console.log('姓名:', this.getName()); console.log('省份:', this.getProvince()); console.log('城市:', this.getCity()); console.log('地区:', this.getArea()); } } var student = new Student('张三', '湖北省', '黄冈市', '罗田县'); student.getInfo(); ```