Essential JavaScript

Strings Intro

We already know that JavaScript can work with numbers. JavaScript can work with text as well. In JavaScript, text data is called a string.

Technically, a string is a sequence of characters. A character could be a letter, a numeral, an emoji, or anything that appears when you hold the Shift key and press a number on your keyboard.

To create a string, type the text between quotation marks. Try these examples:

  • 'single quotes'
  • "double quotes"
  • `backticks`

All three types of quotation marks can be used to create a string.

Notice that if you don't use quotation marks, you will get an error. JavaScript will try to interpret your text as JavaScript code instead of text data unless you use quotation marks.


Learning Goals

Code Editor