let game = { up: function(){ console.log("up methods!") }, down: function (){ console.log("down methods!") } } // es6 symbol 用法 可以给已经封装好的方法上加上方法 let methods = { up: Symbol(), down: Symbol() } game[methods.up] = function(){ console.log("我可以改变形状"); } game[methods.down] = function(){ console.log("我可以快速下降") }
标签:function,es6,console,methods,Symbol,up,log From: https://www.cnblogs.com/moon-yyl/p/17528039.html