Hi Friends đź‘‹,
Welcome To Infinitbility! ❤️
Today, we are going to learn concat two strings in javascript, here we will use the plus ( + )
operator to join both strings, we will also see append strings with separators like comma (,).
The plus operator basically used for adding but if you use this operator between strings it will concat string.
Well, let’s start today’s tutorial How to concat two strings in javascript?
let’s plan what we are going to do.
- create two string variable with some data
- create function and write logic to concat
- use function to concat string with separator
1// create two string variable with some data2const str1 = "infinitbility";3const str2 = "aguidehub";45// create function and write logic to concat6function concat(str1, str2) {7 return str1 + ',' + str2;8}910// use function to concat string with seprator11concat(str1, str2)
When you run the above code, you will both string join to each other with comma separator.
let’s check the output.

I hope it’s help you, All the best 👍.
Follow me on Twitter
Join our email list and get notified about new content
No worries, I respect your privacy and I will never abuse your email.
Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.