JavaScript strings are used for storing text and manipulating it.
A JavaScript string is used to store a series of characters like "Pranav Chhabra".
A string can be any text inside quotes
Example
<!DOCTYPE html>
<html>
<body>
<p id="ex"></p>
<script>
var carName1 = "swift";
var carName2 = 'Ecco sport';
document.getElementById("ex").innerHTML =
carName1 + "<br>" + carName2;
</script>
</body>
</html>
OUTPUT
swift
Ecco sport
String Length
The length of the string is determined byin the built in property length
<p id="demo"></p>
<script>
var txt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
document.getElementById("demo").innerHTML = txt.length;
</script>
</body>
</html>
OUTPUT
26
0 Comment(s)