How To Use String Object Concat In Java Script

In this article I am going to explain about String Object Concat In JavaScript.
  • 1499

Use concat() method in JavaScript

The concat() method is used to join two or more string.

This method join of two string and show the another new string in the JavaScript.

All browsers support string object concat() method.


string.concat(string1, string2, ..., stringX)


<!DOCTYPE html>


<body style ="background-color:Red" >


<p id="demo">Join two strings into one new string.</p>


<button onclick="myFunction()">Click here</button>


<script type="text/javascript">

    function myFunction()


        var txt1 = "Welcome ";

        var txt2 = "India!";

        var n = txt1.concat(txt2);

        document.getElementById("demo").innerHTML = n;










Further Readings

You may also want to read these related articles :here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.