Javascript unshift() Method - Array Function

How to add new elements into the Beginning of the array and shift the index of the subsequent element to the higher value ?
What is the use of unshift() function in javascript?

Explanation

Method: unshift() :
This function add new elements into the Beginning of the array and shift the index of the subsequent elements to the higher value. It also returns the new length of the array.
Syntax:
array1.unshift();

Example:


<script type="text/javascript">
var a["a","b","c","d"]
var ele = stack.unshift(3);
document.write(ele);
</script>

Result:



In the above example, this method add new element to the beginning of the array and has displayed the result as"5".