Previous Lecture Complete and continue  

  Intro into Strings

What is a String

A string is one of JavaScript's 6 primitive data types. Strings are used to store a series of characters. Strings always start and end with either single quotation marks or double quotation marks. If a string starts with a single quotation mark, it must end with a single quotation mark and if it starts with a double quotation mark, it must end with a double quotation mark. Below are some examples of valid strings:

'This is a string'

"This is also a string"

Strings often look extremely familiar because they can contain letters, sentences, and phrases. However, strings can also contain numbers, characters, spaces, and even no characters. Strings with nothing in them are considered empty. Below are examples of valid strings that do not container sentences or phrases. The last example is an empty string using single quotation marks.


'#[email protected]#^&()#!'

" "