A String is a set of characters.
It can contain any text data.
It should be surrounded with either Single Quote (') or Double quote (").
[Note: Be consistent]
'A Text Data'
"A Text Data"
""
Assigning string to a variable
var name = "John Doe";
Some special charcters can be represented with Escape sequence
Following are the commonly used Escape sequence
- \n- New Line
- \r- Carriage Return
- \t- Tab
- \t- Tab
var message = "Hi\r\nGood Morning";
Concatenation
Multiple Strings can be combined to form one string.
Plus (+) operator can be used.
var message = "Hi" +
"\r\nGood Morning";