class prototype 共享内存

来源:互联网 发布:ipad软件的目录 编辑:程序博客网 时间:2024/06/04 19:59
  (function () {            var user = '';            Box = function (value) {                user = value;            }            Box.prototype.getUser = function () {  //share                return user;            }        })();        var a1 = new Box("Lee");        alert(a1.getUser());        var a2 = new Box("JIN");        alert(a1.getUser());

0 0
原创粉丝点击