.concat()
mehboobali986 total contributions
Published Jun 21, 2021Updated Jun 28, 2023
Contribute to Docs
Concatenates or combines strings together.
Syntax
string.concat(string_1, string_2, string_3);
Example 1
Concatenating a string:
console.log('Would you like a latte or '.concat('cappuccino?'));// Output: Would you like a latte or cappuccino?
Example 2
Concatenating strings with the usage of variables:
const x = 'Would you like a latte or';const y = 'cappuccino?';console.log('Hey Bob! '.concat(x, ' ', y));// Output: Hey Bob! Would you like a latte or cappuccino?
Codebyte Example
The following is runnable, and demonstrates the use of the .concat()
method:
All contributors
- mehboobali986 total contributions
- christian.dinh2481 total contributions
- Anonymous contributorAnonymous contributor3077 total contributions
- Anonymous contributorAnonymous contributor51 total contributions
- mehboobali98
- christian.dinh
- Anonymous contributor
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.