Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you may not be able to execute some actions.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
function createCache(){ const data = {} //闭包中的数据,特点:被隐藏不被外界访问 // 只提供API用于外界访问 return { set : function (key, val) { data[key] = val }, get: function (key) { return data[key] } } } const c = createCache() c.set('a', 100) console.log(c.get('a'))
No one has replied