Stringhe e virgolette in Javascript






' Stringhe di JavaScript

' È possibile utilizzare le virgolette all'interno di una stringa, purche' non corrispondano alle virgolette che circondano la stringa.


https://www.w3schools.com/js/tryit.asp?filename=tryjs_string_quotes_mixed

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Strings</h2>

<p>You can use quotes inside a string, as long as they don't match the quotes surrounding the string.</p>

<p id="demo"></p>

<script>
var answer1 = "It's alright";
var answer2 = "He is called 'Johnny'";
var answer3 = 'He is called "Johnny"';

document.getElementById("demo").innerHTML =
answer1 + "<br>" + answer2 + "<br>" + answer3;
</script>

</body>
</html>

' utilizza le virgolette

https://www.w3schools.com/js/tryit.asp?filename=tryjs_string_quotes


<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Strings</h2>

<p>Strings are written inside quotes. You can use single or double quotes:</p>

<p id="demo"></p>

<script>

var carName1 = "Volvo XC60"; // Double quotes
var carName2 = 'Volvo XC60'; // Single quotes

document.getElementById("demo").innerHTML =
carName1 + " " + carName2;

</script>

</body>
</html>












( stringheevirgoletteinjavascript.html )- by Paolo Puglisi - Modifica del 17/12/2023