String Expressions
Strings
π¨βπΌ Strings are one of the most common types of data in programming. Let's
explore what you can do with them.
You can combine strings together using the
+ operator. This is called
concatenation:console.log('Hello' + ' ' + 'World') // Prints: Hello World
π¨ Open
and complete the following tasks:
- Concatenate the strings
"Hello", a space, and"TypeScript", then log the result (output must includeHello TypeScript) - Concatenate your first name, a space, and your last name, then log the result
- Concatenate multiple small string pieces to produce exactly:
I am learning to code(include the spaces between words)
Completion criteria
- Output includes
Hello TypeScript - Output includes
I am learning to code - Your source uses the
+operator to concatenate string literals at least three times (this step is about concatenation, not template literals)
π° Remember to include spaces where you need them - the
+ operator joins
strings exactly as they are!If you're using an AI editor, the editor might try to avoid the extra
+
because you can write this more easily without it. The tests for this step
check for + concatenation, so avoid template literals here.