We can get all elements of an array by using valueOf(). The elements will be separated by comma. These are the primitive values of the array.
Here is a sample code.
<script>
var scripts = new Array();
scripts[0] = "PHP";
scripts[1] = "ASP";
scripts[2] = "JavaScript";
scripts[3] = "HTML";
document.write(scripts.valueOf());
</script>
The output is here
PHP,ASP,JavaScript,HTML
We can add another array to this
<script type="text/javascript">
servers= new Array('Apache', 'IIS');
var scripts = new Array();
scripts[0] = "PHP";
scripts[1] = "ASP";
scripts[2] = "JavaScript";
scripts[3] = "HTML";
scripts[4] = servers;
document.write(scripts.valueOf());
</script>