String Concatenation Operator (+)
Syntax
string1 + string2Description
Examples
Basic String Concatenation
result = "hello" + "world"
log result // Outputs: "hello world"
// Notice the space is automatically added between "hello" and "world"Mixed Type Concatenation
// Concatenating strings with numbers
message = "The answer is" + 42
log message // Outputs: "The answer is 42"
// Concatenating multiple items
fullName = "John" + "Doe" + "Smith"
log fullName // Outputs: "John Doe Smith"Building Sentences
Comparison with Other String Operators
+ vs. ++ Operator
+ vs. .append() Method
Notes
Last updated