Concatenates or combines strings together.


string.concat(string_1, string_2, string_3);

Example 1

Concatenating a string:

console.log('Do you like Latte or '.concat('Cappuccino?'));
// Output: Do you like Latte or Cappuccino?

Example 2

Concatenating strings with the usage of variables:

const x = 'Do you like Latte or';
const y = 'Cappuccino?';
console.log('Hey Bob! '.concat(x, ' ', y));
// Output: Hey Bob! Do you like Latte or Cappuccino?


Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn JavaScript on Codecademy