摘要: 阅读全文
posted @ 2021-05-15 15:11 富坚老贼 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 通过闭包封装私有变量 function a() { //函数外访问不到 var s = 3; //使外部能够获得s变量的值 this.f = function () { return s } //改变s的值 this.add=function(){ s++ } } var t = new a() t 阅读全文
posted @ 2021-05-15 10:15 富坚老贼 阅读(29) 评论(0) 推荐(0) 编辑