Hi dear welcome to "CodePrime" Blog . In this post you are going to learn JavaScript Concat & Join Function Tutorial | Javascript Tutorial: 24 . First Creat A index.html file Copy This HTML CODE and pest it one your code editor. 2ndly creat concat-join.js file Then Copy The JS CODE and pest it then open the index.html file with your browser.
HTML CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="/concat-join.js"></script>
<title>javascript</title>
</head>
<body >
<h2>Javascript Tutorial <br>By Codeprime</h2><br><br><br>
</body>
</html>
JAVASCRIPT CODE
var a = ["Hanif", "Rubia","Abbas"];
document.write(a + "<br><br>");
//concat example-1
var b = a.concat("Abbas");
document.write(b + "<br><br>");
//concat example-2
var c = a.concat(b);
document.write(c + "<br><br>");
//concat example-3
var d = a.concat(b,c);
document.write(d + "<br><br>");
//join example
var b = a.join(" - ");
document.write(b + "<br><br>");
0 Comments