Is there a way to customize/override assignment operations in JavasScript?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 23:26:57
  1. No this is not possible
  2. If it was possible, you really would not want to do this, at least not globally.

  • The string variable type does not have all the extra overhead that an object does.
    Note: the string array that is created (in your case, foo) would have other properties (eg foo.length)
  • Objects come at a performance hit
samwyse

It's not quite what you're looking for, but you may want to look at Overriding assignment operator in JS

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!