Concatenation

In any programming language, string concatenation simply means appending one or more strings to another string. For example, when strings "World" and "Good Afternoon" are concatenated with string "Hello", they form the string "Hello World, Good Afternoon". We can concatenate a string in several ways in JavaScript.

Example:

const icon = '👋';

// using template Strings
`hi ${icon}`;

// using join() Method
['hi', icon].join(' ');

// using concat() Method
''.concat('hi ', icon);

//  using + operator
'hi ' + icon;

// RESULT
// hi 👋

📝 Task:

💡 Hints:

  • Visit the concatenation chapter of strings for more info about string concatenation.

Last updated

Was this helpful?