【发布时间】:2016-03-12 15:15:50
【问题描述】:
我的目标是用 window.btoa() 对我的 programmcode 进行编码,但是我如何编写一个带有 programmcode 的字符串 - 问题是编译器认为该字符串在代码中的第一个 " 之后结束。
示例:
var engine = '';
function all_this_in_the_string() {
var examples_string = 'single';
var double_ = "double";
}
// I have about 600 lines code with single and double quotes...of course the code is in more than one line.
// Is there a way to get this code into the string (engine) that i can encode with the line above ?
console.log(window.btoa(engine));
问候, 大卫
【问题讨论】:
-
然后正确引用代码
-
转义引号?
-
@FelixKling 我编辑了我的问题,这不是我搜索的内容 - 感谢您的说明。 :)
-
@FelixKling 并删除标记为重复的-.-
-
也许您正在寻找
all_this_in_string.toString()?还真说不出来。请将您的问题的标题更新为描述性的内容。我还建议阅读 How to Ask 以了解如何提出更好的问题。
标签: javascript window encode