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 251 views
1 answer 136 views
1 answer 114 views
1 answer 124 views
1 answer 118 views
...