array concat in js with example

by Prabakaran 2012-09-07 17:54:40

<script language="javascript" type="text/javascript">
function function1(){
var c=array.concat(array1);
document.write("<center>"+"Array after merging is: "+""+"<br>");
document.write("===================="+"<br>");
for(var i=0;i<c.length;i++){
document.write(c[i]+"<br>")
}
}
var array=new Array();
array[0]="Ram";
array[1]="Ravi";
array[2]="Sundar";
array[3]="Gobi";
document.write(""+"Element in the array are "+""+ "<br />");
document.write("================="+ "<br />");
for(var i=0;i document.write(array[i]+"<br>")
}

var array1=new Array();
array1[0]="A";
array1[1]="B";
array1[2]="C";
array1[3]="D";
document.write(""+"Element in the array are "+""+ "<br />");
document.write("================="+ "<br />");
for(var j=0;j
document.write(array1[j]+"<br>")
}
document.write("<br />");
</script>

<button onclick="function1();">Merge Arrays</button>
788
like
0
dislike
0
mail
flag

You must LOGIN to add comments