Different result from JavaScript RegExp in “rhino1.7.6” vs “V8”

三世轮回 提交于 2019-12-06 07:16:52

Given the value function() { return "\x3c" }

  • Chrome converts it to the string "function() { return "\x3c" }", that is, a literal backslash followed by "x3c".

  • Rhino converts it to the string "function () { return "<"; }", that is, it reformats the function definition.

Both are actually correct behaviour. The ECMA-262 (a.k.a. Javascript) standard says that String(func) should return "an implementation-dependent String source code representation of func."

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