Thumb

JavaScript String

1/21/2020 6:34:19 AM

JavaScript string can write into double quote. The string can be a text. When we write some number or symbol into double quote then the full text considers as a string. However, string is also a data type in JavaScript like number. Basically, when we print the output however it is it first convert the string then show the output. Now given bellow some string example code and explain the code:

<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
<script type="text/javascript">
 //JavaScript String
var strOne="Farhan Sakib";
var strTwo="001144568";
var strThree="@%*&^()#";
 //print the Strings
console.log(strOne);
console.log(strTwo);
console.log(strThree);
</script>
</body>
</html>

We can see first we write string variables and assign the value under double quote. So, when we write something under double quote it considers as the string. Then we print the string value using the ‘console.log’ function.