Javascript code to prepend an item at the beginning of array using arr.unshift()
Prepend one value to array
<script type="text/javascript"> var arr = ["v1", "v2"]; arr.unshift("newitem"); arr.forEach (function(item, idx) { document.write("idx=" + idx + " item=" + item + "<br/>"); }); </script>