Search This Blog

Sunday, 31 July 2016

How to use "double quote" inside the string in javascript?

Html page:

<p id="P9"></p>

Javascript page:

<script>
    var x = 'It\'s alright';
    var y = "We are the so-called \"Vikings\" from the north.";
    document.getElementById("demo").innerHTML = x + "<br>" + y;
</script>

Output:
It's alright

We are the so-called "Vikings" from the north.

No comments:

Post a Comment