Loading, please wait...

Strings

JavaScript Strings

JavaScript Strings are mainly used for storing and manipulating text.

JavaScript Strings is mainly a continuous series of characters that are to be placed within quotes.

String data type is always placed within quotes which is either single or double quotes.

 

For example,

var str = ‘Hello TutorialsLink!’;

var str1 = “Hello TutorialsLink!”

 

We can also use quotes inside a string which is already surrounded by a pair of quotes, as long as they don’t match that quotes which are surrounding the string.

 

For example,

var str = “Hello ‘TutorialsLink!’ ”;

 

Code:

<html> 
<head> 
</head> 
<body> 
<script>
var str = 'Welcome \' TutorialsLink! \'';
document.write(str);
</script>
</body> 
</html>

 

Output: