javascript 严格模式报错

js严格模式使用费严格模式的代码报错 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to thems

严格模式下,arguments.callee.caller 是否有替代方案?

阅读 3.3k
3 个回答

这些不建议用,最好还是根据名字来引用,这样好看点

你在函数前面加个声明函数变量,比如:var f_only = (function f(o){})

arguments.caller,在严格模式下无法访问,非严格模式下值也为undefined,
我记得貌似被废弃了把已经

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题