Essential JavaScript
Introduction
JavaScript Basics
Numbers
Strings
Logic
Variables
Loops
Objects
Arrays
Going Further
Essential JavaScript
Introduction
JavaScript Basics
Numbers
Strings
Logic
Variables
Loops
Objects
Arrays
Going Further
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
I know what a string is
I know what a character is
I can create a string with different quotation marks
Code Editor
Click "Run Code" to execute your JavaScript in a secure sandbox and see the output below.
Console Output
0 output lines