[英]Override Map.get method
I wanted to see if I could override the get method on the Map object, this was unexpected. 我想看看是否可以覆盖Map对象上的get方法,这是意外的。 Can anyone tell me why?
谁能告诉我为什么?
Welcome to Node.js v12.8.1.
Type ".help" for more information.
> Map.prototype.get = function() { console.log("test") }
test
test
test
test
test
test
...and on forever...
console.log
可能会调用Map
因此会创建一个无限循环。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.