How to use double quotes in string with JavaScript

2 Answers

0 votes
let html = '<div id="divid">javascript</div>';

console.log(html);


 
 
 
/*
run:
 
<div id="divid">javascript</div>
 
*/

 



answered Feb 4, 2021 by avibootz
0 votes
let html = "<div id=\"divi\">javascript</div>";

console.log(html);


 
 
 
/*
run:
 
<div id="divid">javascript</div>
 
*/

 



answered Feb 4, 2021 by avibootz

Related questions

1 answer 350 views
1 answer 231 views
1 answer 219 views
1 answer 235 views
1 answer 203 views
...