Every line of 'text to html javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
159 function html2js(text){ 160 var split1 = text.split("\n"); 161 text = "var text = \"\";\n"; 162 for(var i=0;i<split1.length;i++) { 163 var str = split1[i]; 164 text += "text += \""+str.replace(/"/g,"\\\"")+"\";\n"; 165 } 166 return text; 167 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code