Search⌘ K

Strings

Explore how JavaScript uses strings to represent text values, learn to concatenate strings with the plus operator, and understand how to include special characters with escape sequences. This lesson helps you write and format text correctly in your code.

Strings

Strings, another basic data type, represent a string (or sequence) of characters. Strings are how we represent text values in our code.

Strings can be created by wrapping text in single ('') or double ("") quotation marks.

Node.js
var text = "Hey there, this is a JavaScript string!";
var alsotext = 'Hey there, another string!';
console.log(text);
console.log(alsotext);

String operations #

Operations on strings are limited. For instance, you cannot subtract, multiply, or ...