JavaScript Strings - How To Work with Strings in JavaScript
JavaScript Strings
- A JavaScript string is a sequence of characters enclosed within single quotes ('') or double quotes (""). It is a data type used to represent and manipulate text in JavaScript.
JavaScript Strings Example 1
- A JavaScript string is zero or more characters written inside quotes.
Sample Code
Output
JavaScript Strings Example 2
- You can use single or double quotes.
Sample Code
Output
String Length
- To find the length of a string, use the built-in length property.
Sample Code
Output
Escape Character
- Strings must be written within quotes, JavaScript will misunderstand this string.