This method does not change the existing strings, but returns a new string containing the text of the joined strings.
Two different strings in different variables. Both variables can be joined using concate().
Code:-
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<h1>join two string using concat()</h1>
<input type="button" onclick="fun1();" value="Concat two string">
<script>
function fun1()
{
var str1 = "Allinworld";
var str2 = "99";
alert("str1 : " + str1);
alert("str2 : " + str2);
alert(str1.concat(str2));
}
</script>
</body>
</html>
Join two string using concat:- Geniusofstudent
Reviewed by
Network security
on
June 25, 2019
Rating:
5
No comments: