A string in javascript is a series of characters. We can store string data either in double quotes or single quotes. All the following samples are valid string declarations.
var v1="palle technologies";
var v2='palle technologies';
var v3="palle 'technologies'";
var v4='"palle" technologies';
var v5="c:\\students\\data.txt";
var v6="it\'s time to party';
Note: Take utmost attention while using escape characters in javascript. Javascript supports following escape characters and most of the escape characters starts with slash [\] symbol. Look at the following escape characters.
Escape characterOutput
\'Single quote
\"Double quote
\\Back slash
\nNew line
\rCarriage return
\bBack space
\fForm feed
The following code will not work since \s and \h are unrecognized escape characters and hence javascript run time will throw an exception.
var v1="d:\songs\hindisongs.txt";
Hence for displaying the above hindisongs.txt files full path use following syntax.
var v1="d:\\songs\\hindisongs.txt";
Note: Most of the javascript built-in functions and properties are starting with lower case letters or will follow camel casing conventions

Important String property:


length property will give total number of characters present in a given string.


var v='palle technologies';
alert(v.length); //this code gives 18 as output.