How To Use String Object Concat In Java Script
In this article I am going to explain about String Object Concat In JavaScript.
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.
Syntax
string.concat(string1, string2, ..., stringX)
|
Example
<!DOCTYPE html>
<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;
}
</script>
</body>
</html>
|
Output1

Output2

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