JavaScript Reference/Javascript Methods/unshift

Материал из Web эксперт
Перейти к: навигация, поиск

"unshift()" Example

    
<html>
<body>
<button onclick="var myA = new Array(10,11,12); myA.unshift(1); alert(myA);">
unshift array
</button>
</body>
</html>



"unshift()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |Array                                                         |
+----------------+--------------------------------------------------------------+



"unshift()" Syntax, Parameters and Note

Note:
Adds elements to Array"s start and returns the enlarged array.
    
Syntax:
    
arrayName.unshift(paramN, . . . ,paramN)
Parameters:
    paramN   Required; the elements to be added.