Data Types

String

🙋 Need help? Ask an expert now!

Strings represent a sequence of characters. They are always enclosed in either single quotes (') or double quotes ("). Starting ES6, or ECMAScript 2015, back ticks \` can also be used to represent strings. String can be concatenated using the + operator as shown in the code sample below.

Additionally, strings are stored as Unicode, a industry standard for the encoding, representation, and handling of text expressed in most programming languages. Unicode supports all commonly used alphabets in the world, including Cyrillic, Chinese, Arabic, Greek, Spanish, English, German etc. The sample code below shows the use of Arabic, Bulgarian, and Japanese.

The sample program above shows two examples of string concatenation. The first example prints a welcome message using string variables and the second example prints a person's full name. Although, string concatenation will be explored in-depth later in the course, try to understand how it works so you can use it. String concatenation is pretty straightforward as the '+' operator simply adds two strings together. The unicode examples show how any language can be used in the program and printed correctly on the console. Search up unicode and see if the languages you speak are supported!

Edit Me on GitHub!

Application Question

Which of the following statements are valid string declarations?