Composite Data Types

Some types of data are really compositions of other types of data. They might be made up of primitives, other composites, or a combination of both.

String

A string is perhaps the simplest composite data type; it is just a composition of characters. I consider strings to be important because they tend to be the easiest type of data to understand. They are basically just text, and most people understand text. Strings are used all over in computer programs. You already used strings in prompt.js in two ways. First, you stored the user’s name as a string in the variable userName. Second, you constructed a message to be displayed to the user by concatenating several strings (including the strings stored in variables in values.js ...

Get Learning to Program now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.