Here you can find a number of examples on Java Script.Please find the various kinds of examples listed on the right side of this site. If you don't find anything on Java Script then please write to us or leave a commnet. We are pleased to help and find the solution of your problem.
Showing posts with label separator. Show all posts
Showing posts with label separator. Show all posts

JavaScript: Join Function



join Function:
Joins all elements of an array into a string.

Syntax:
join(separator);



Example in HEAD section:

<html>
<head>
<script language="javacsript">
num=new Array("One""two","Three","our");
var str;
str=num.join();
document.write(str + "<br>");
str=num.join(" , ");
document.write(str + "<br>");
str=num.join(" + ");
document.write(str + "<br>");
</script>
</head>
</html>


Example in BODY section:

<html>
<head>
<script language="javacsript">
</head>
<body>
num=new Array("One""two","Three","our");
var str;
str=num.join();
document.write(str + "<br>");
str=num.join(" , ");
document.write(str + "<br>");
str=num.join(" + ");
document.write(str + "<br>");
</script>
</body>
</html>




OUTPUT

One,two,Three,Four
One , two , Three , Four
One + two + Three + Four
Google