Navigate back to the homepage

How to concat two strings in javascript?

Infinitbility
JavaScript
May 20th, 2022 · 1 min read

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.

  1. create two string variable with some data
  2. create function and write logic to concat
  3. use function to concat string with separator
1// create two string variable with some data
2const str1 = "infinitbility";
3const str2 = "aguidehub";
4
5// create function and write logic to concat
6function concat(str1, str2) {
7 return str1 + ',' + str2;
8}
9
10// use function to concat string with seprator
11concat(str1, str2)

When you run the above code, you will both string join to each other with comma separator.

let’s check the output.

javascript, concat two strings example
javascript, concat two strings example

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.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Guide book

Guidebook: The Javascript Monorepo Photoshop Guide

Tutorials

Categories

More articles from Infinitbility

How to solve 403 forbidden error in laravel?

In this tutorial, we are cover laravel 403 forbidden error causes and their solutions.

May 20th, 2022 · 1 min read

How to append an array to another array in javascript?

Example of append an array to another array in javascript with step by step guide.

May 19th, 2022 · 1 min read
© 2020–2022 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]