当我使用仅 包含node.js的文件执行文件时{"test":1}
,会引发SyntaxError:
(function (exports, require, module, __filename, __dirname) { {"test":1}
^
SyntaxError: Unexpected token :
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
但是{test:1}
(不带引号)还是var t = {"test":1}
可以的。
我执行了包含正在运行的代码的文件node test.js
。
为什么 ?
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句