我的目标是使用window.btoa()对我的programmcode进行编码,但是如何在其中编写带有programmcode的字符串 - 问题在于,comipiler认为字符串在第一个"之后结束。在代码中。
示例:
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));

映入眼帘, 大卫
答案 0 :(得分:0)
您需要在单引号和双引号之间进行选择。
var engine = 'function() { var examples_string = "here_is_the_problem"}';