Convert string to JavaScript code
mtbink.com logo

Convert string to JavaScript code

Input
Variable name (String)
String
Output (String)

The function of this online utility is to convert string to JavaScript code.

For example, if the variable name is t and the string is:

line "1"
line '2'
line 3:\test1\test2
then the output will be:
let t = "";
t += "line \"1\"" + "\r\n";
t += "line '2'" + "\r\n";
t += "line 3:\\test1\\test2";
.

Search the entire website:

Flag Counter
RSS