0
我真的不知道爲什麼是這樣的情況 -字符串不能換行字符拆分
一個字符串,如以下是""double-encoded""
:
" => Suman => fatal error in suite with path=\"/Users/amills001c/WebstormProjects/oresoftware/suman/test/build-tests/test6.js\"\n (note: You will need to transpile your test files if you wish to use ES7 features)" => error => "SyntaxError: Unexpected reserved word\n at exports.runInThisContext (vm.js:53:16)\n at Module._compile (module.js:373:25)\n at Object.Module._extensions..js (module.js:416:10)\n at Module.load (module.js:343:32)\n at Function.Module._load (module.js:300:12)\n at Module.require (module.js:353:17)\n at require (internal/module.js:12:17)\n at Domain.<anonymous> (/Users/amills001c/WebstormProjects/oresoftware/suman/lib/run-child.js:33:5)\n at Domain.run (domain.js:228:14)\n at Object.<anonymous> (/Users/amills001c/WebstormProjects/oresoftware/suman/lib/run-child.js:32:3)"
它的原因雙編碼是因爲它像創建:
var str = "foo" + JSON.stringify(bar) + "baz";
是有一個很好的理由,我將無法再拆與String(str).split('\n')
生成的字符串?似乎是這樣,只是好奇爲什麼那樣。
謝謝合理 –