Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
91
rated 0 times [  96] [ 5]  / answers: 1 / hits: 16068  / 11 Years ago, wed, september 4, 2013, 12:00:00

How do replace backslash double quote (e.g. ) in a string?



The code below does not work.



<!DOCTYPE html>
<html>
<head>
</head>
<script type=text/javascript>

var myVar = 'Things You Should Know';
document.write(myVar.replace(/\/g, '|'));
</script>
<body>
<br>hello
</body>
</html>

More From » javascript

 Answers
6
var myVar = 'Things You Should Know';
document.write(myVar.replace(//g, '|'));


The escapes the next character so your string only reads Things You Should Know


[#75893] Tuesday, September 3, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bryantc

Total Points: 455
Total Questions: 96
Total Answers: 110

Location: San Marino
Member since Thu, Jun 30, 2022
2 Years ago
bryantc questions
Fri, Aug 13, 21, 00:00, 3 Years ago
Tue, Mar 30, 21, 00:00, 3 Years ago
Fri, Jun 5, 20, 00:00, 4 Years ago
Wed, May 27, 20, 00:00, 4 Years ago
;